Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
grapa_alisa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alisa Jung
grapa_alisa
Commits
dd531f25
Commit
dd531f25
authored
Nov 19, 2015
by
Alisa Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
well... at least this shit is compiling
parent
0122e0aa
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
161 additions
and
3 deletions
+161
-3
box.cpp
helloqube/box.cpp
+117
-0
box.h
helloqube/box.h
+16
-0
helloqube.pro
helloqube/helloqube.pro
+4
-2
helloqube.pro.user
helloqube/helloqube.pro.user
+1
-1
primitive.cpp
helloqube/primitive.cpp
+13
-0
primitive.h
helloqube/primitive.h
+10
-0
No files found.
helloqube/box.cpp
0 → 100644
View file @
dd531f25
#include "box.h"
Box
::
Box
(
int
ID
,
char
*
name
,
int
tesselation
)
:
Primitive
(
ID
,
name
,
tesselation
)
{
}
Box
::~
Box
(){
}
void
Box
::
drawPrimitive
(){
//tesselation
double
qubeWidth
=
1.0
;
double
dist
=
qubeWidth
/
(
double
)
tesselation
;
//4.1.1 Unit Qube + Tesselation + Diffuse Material
GLfloat
specularColor
[]
=
{
1
,
1
,
1
};
GLfloat
shininess
[]
=
{
128
};
//specular exponent
glMaterialfv
(
GL_FRONT
,
GL_SPECULAR
,
specularColor
);
glMaterialfv
(
GL_FRONT
,
GL_SHININESS
,
shininess
);
// //vorne // z-Achse
// // glColor3f(0,0,1);//blau //alt und doof
// GLfloat blue[] = { 0, 0, 1 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, blue);
// glNormal3f(0, 0, 1);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*i, 0.5 - dist*j, 0.5);
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*j, 0.5);
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*(j + 1), 0.5);
// glVertex3f(0.5 - dist*i, 0.5 - dist*(j + 1), 0.5);
// }
// }
// glEnd();
// //oben // y-Achse
// GLfloat green[] = { 0, 1, 0 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, green);
// glNormal3f(0, 1, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*(i + 1), 0.5, 0.5 - dist*(j + 1));
// glVertex3f(0.5 - dist*(i + 1), 0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*i, 0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*i, 0.5, 0.5 - dist*(j + 1));
// }
// }
// glEnd();
// //rechts //x-Achse
// GLfloat red[] = { 1, 0, 0 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, red);
// glNormal3f(1, 0, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5, 0.5 - dist*i, 0.5 - dist*j);
// glVertex3f(0.5, 0.5 - dist*(i + 1), 0.5 - dist*j);
// glVertex3f(0.5, 0.5 - dist*(i + 1), 0.5 - dist*(j + 1));
// glVertex3f(0.5, 0.5 - dist*i, 0.5 - dist*(j + 1));
// }
// }
// glEnd();
// //hinten // z-Achse
// GLfloat yellow[] = { 1, 0.9f, 0 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, yellow);
// glNormal3f(0, 0, -1);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*i, 0.5 - dist*(j + 1), -0.5);//4
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*(j + 1), -0.5);//3
// glVertex3f(0.5 - dist*(i + 1), 0.5 - dist*j, -0.5);//2
// glVertex3f(0.5 - dist*i, 0.5 - dist*j, -0.5);//1
// }
// }
// glEnd();
// //links
// GLfloat cyan[] = { 0, 1, 1 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, cyan);
// glNormal3f(-1, 0, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(-0.5, 0.5 - dist*i, 0.5 - dist*(j + 1));
// glVertex3f(-0.5, 0.5 - dist*(i + 1), 0.5 - dist*(j + 1));
// glVertex3f(-0.5, 0.5 - dist*(i + 1), 0.5 - dist*j);
// glVertex3f(-0.5, 0.5 - dist*i, 0.5 - dist*j);
// }
// }
// glEnd();
// //unten //-y
// GLfloat magenta[] = { 1, 0, 1 };
// glMaterialfv(GL_FRONT, GL_DIFFUSE, magenta);
// glNormal3f(0, -1, 0);
// glBegin(GL_QUADS);
// for (int i = 0; i < tesselation; i++){
// for (int j = 0; j < tesselation; j++){
// glVertex3f(0.5 - dist*i, -0.5, 0.5 - dist*(j + 1));
// glVertex3f(0.5 - dist*i, -0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*(i + 1), -0.5, 0.5 - dist*j);
// glVertex3f(0.5 - dist*(i + 1), -0.5, 0.5 - dist*(j + 1));
// }
// }
// glEnd();
}
helloqube/box.h
0 → 100644
View file @
dd531f25
#ifndef BOX_H
#define BOX_H
#include <primitive.h>
#include <QDebug>
class
Box
:
public
Primitive
{
public
:
Box
(
int
ID
,
char
*
name
,
int
tesselation
);
~
Box
();
void
drawPrimitive
()
override
;
};
#endif // BOX_H
helloqube/helloqube.pro
View file @
dd531f25
...
...
@@ -18,14 +18,16 @@ SOURCES += main.cpp\
scenegraph
.
cpp
\
primitive
.
cpp
\
rigidbodytransformation
.
cpp
\
controller
.
cpp
controller
.
cpp
\
box
.
cpp
HEADERS
+=
mainwindow
.
h
\
myglwidget
.
h
\
scenegraph
.
h
\
primitive
.
h
\
rigidbodytransformation
.
h
\
controller
.
h
controller
.
h
\
box
.
h
RESOURCES
+=
\
helloqube
.
qrc
...
...
helloqube/helloqube.pro.user
View file @
dd531f25
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-11-1
5T21:45:35
. -->
<!-- Written by QtCreator 3.5.1, 2015-11-1
9T23:00:19
. -->
<qtcreator>
<data>
<variable>
EnvironmentId
</variable>
...
...
helloqube/primitive.cpp
View file @
dd531f25
...
...
@@ -5,3 +5,16 @@ Primitive::Primitive()
}
Primitive
::~
Primitive
(){
}
Primitive
::
Primitive
(
int
ID
,
char
*
name
,
int
tesselation
){
this
->
ID
=
ID
;
this
->
name
=
name
;
this
->
tesselation
=
tesselation
;
}
void
Primitive
::
drawPrimitive
(){
}
helloqube/primitive.h
View file @
dd531f25
#ifndef PRIMITIVE_H
#define PRIMITIVE_H
#include <QtOpenGL>
class
Primitive
{
public
:
Primitive
();
~
Primitive
();
Primitive
(
int
ID
,
char
*
name
,
int
tesselation
);
virtual
void
drawPrimitive
();
protected
:
int
ID
;
char
*
name
;
int
tesselation
;
};
#endif // PRIMITIVE_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment