Just starting out in the 3d video (game) world, I have been playing with openGL and WOW - where has it been all my life?
Anyway, I wish to make flat (eg Y-axis fixed) square. However, I wish to make it out of other smaller squares. So I end up with a checkerboard effect.
However, when I compile and view the scene my little squares do not look square. Well, they look a mess of rand triangles.
Ang ideas on how to fix or achieve my goal?
some of my code:
void initGL()
{
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glLineWidth(3.0);
return;
}
void illustrateGLScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -3.0f);
glRotatef(yAngle, 0.0f, 1.0f, 0.0f);
glRotatef(xAngle, 1.0f, 0.0f, 0.0f);
glBegin(GL_QUADS);
for (int i = 0; i < 10; ++i)
{
glColor3f(0.0f, i * 0.1f, 0.0f);
for (int j = 0; j < 10; ++j)
{
glVertex3f(-1.0f * i, -0.2f, 1.0f * j);
glVertex3f(1.0f * i, -0.2f, 1.0f * j);
glVertex3f(1.0f * i, -0.2f, -1.0f * j);
glVertex3f(-1.0f * i, -0.2f, -1.0f * j);
}
}
glEnd();
…
}