OpenGL Super Bible! Page 333 (Web design seattle) // 3rd Vertices

OpenGL Super Bible! Page 333 // 3rd Vertices v[2][0] = x + 20.0f; // X coord for right v[2][1] = nextY; v[2][2] = -50.0f; // Z coord for front // 4th Vertices v[3][0] = x + 20.0f; // X coord for right v[3][1] = nextY; v[3][2] = 50.0f; // Z coord for back // Begin the polygon glBegin(GL_POLYGON); if(iState != AVERAGE) { // Calculate and set the normal vector, unless // averaging selected from the menu. calcNormal(v,normal); glNormal3fv(normal); } else // Average normals. Here we cheat because we know // the normal points either up or down { // Normal points straight up if(nextY == 10) glNormal3f(0.0f,1.0f, 0.0f); else // Normal points straight down glNormal3f(0.0f,-1.0f, 0.0f); } // Specify the left two verticies glVertex3fv(v[0]); glVertex3fv(v[1]); // Do the same, but the normal on the other side points // the other direction if(iState == AVERAGE) { if(nextY == 10) glNormal3f(0.0f,-1.0f, 0.0f); // points down else glNormal3f(0.0f,1.0f, 0.0f); // points up } // Specify the right two vertices glVertex3fv(v[2]); glVertex3fv(v[3]); glEnd();
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Leave a Reply