Commit 46c09afb by Kai Westerkamp

fixed material shader Bug

parent 25092db6
...@@ -86,8 +86,8 @@ void CubeWidget::paintGL ( ) ...@@ -86,8 +86,8 @@ void CubeWidget::paintGL ( )
GLfloat yellow[] = {1.0,1.0,0.0}; GLfloat yellow[] = {1.0,1.0,0.0};
float increment = 1.0/(pow(2,tesselation)); float increment = 1.0/(pow(2,tesselation));
glBegin(GL_QUADS);
setMaterial(red); setMaterial(red);
glBegin(GL_QUADS);
glNormal3f(0,1,0); glNormal3f(0,1,0);
for (float x = -0.5; x < 0.5 ; x+= increment) { for (float x = -0.5; x < 0.5 ; x+= increment) {
for (float y = -0.5; y < 0.5 ; y+= increment ) { for (float y = -0.5; y < 0.5 ; y+= increment ) {
...@@ -99,8 +99,9 @@ void CubeWidget::paintGL ( ) ...@@ -99,8 +99,9 @@ void CubeWidget::paintGL ( )
} }
glEnd(); glEnd();
glBegin(GL_QUADS);
setMaterial(magenta); setMaterial(magenta);
glBegin(GL_QUADS);
glNormal3f(0,-1,0); glNormal3f(0,-1,0);
for (float x = -0.5; x < 0.5 ; x+= increment) { for (float x = -0.5; x < 0.5 ; x+= increment) {
for (float y = -0.5; y < 0.5 ; y+= increment ) { for (float y = -0.5; y < 0.5 ; y+= increment ) {
...@@ -112,8 +113,9 @@ void CubeWidget::paintGL ( ) ...@@ -112,8 +113,9 @@ void CubeWidget::paintGL ( )
} }
glEnd(); glEnd();
glBegin(GL_QUADS);
setMaterial(green); setMaterial(green);
glBegin(GL_QUADS);
glNormal3f(0,0,1); glNormal3f(0,0,1);
for (float x = -0.5; x < 0.5 ; x+= increment) { for (float x = -0.5; x < 0.5 ; x+= increment) {
for (float y = -0.5; y < 0.5 ; y+= increment ) { for (float y = -0.5; y < 0.5 ; y+= increment ) {
...@@ -125,8 +127,9 @@ void CubeWidget::paintGL ( ) ...@@ -125,8 +127,9 @@ void CubeWidget::paintGL ( )
} }
glEnd(); glEnd();
glBegin(GL_QUADS);
setMaterial(yellow); setMaterial(yellow);
glBegin(GL_QUADS);
glNormal3f(0,0,-1); glNormal3f(0,0,-1);
for (float x = -0.5; x < 0.5 ; x+= increment) { for (float x = -0.5; x < 0.5 ; x+= increment) {
for (float y = -0.5; y < 0.5 ; y+= increment ) { for (float y = -0.5; y < 0.5 ; y+= increment ) {
...@@ -138,8 +141,9 @@ void CubeWidget::paintGL ( ) ...@@ -138,8 +141,9 @@ void CubeWidget::paintGL ( )
} }
glEnd(); glEnd();
glBegin(GL_QUADS);
setMaterial(blue); setMaterial(blue);
glBegin(GL_QUADS);
glNormal3f(-1,0,0); glNormal3f(-1,0,0);
for (float x = -0.5; x < 0.5 ; x+= increment) { for (float x = -0.5; x < 0.5 ; x+= increment) {
for (float y = -0.5; y < 0.5 ; y+= increment ) { for (float y = -0.5; y < 0.5 ; y+= increment ) {
...@@ -150,8 +154,10 @@ void CubeWidget::paintGL ( ) ...@@ -150,8 +154,10 @@ void CubeWidget::paintGL ( )
} }
} }
glEnd(); glEnd();
glBegin(GL_QUADS);
setMaterial(cyan); setMaterial(cyan);
glBegin(GL_QUADS);
glNormal3f(1,0,0); glNormal3f(1,0,0);
for (float x = -0.5; x < 0.5 ; x+= increment) { for (float x = -0.5; x < 0.5 ; x+= increment) {
for (float y = -0.5; y < 0.5 ; y+= increment ) { for (float y = -0.5; y < 0.5 ; y+= increment ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment