Heres my problem:
I'm using SDL and opengl on my linux box
glBeing(GL_QUADS);
glVertex3f( 0.10f,-0.10f, 0.10f);
glVertex3f(-0.10f, 0.10f, 0.0f);
glVertex3f( 0.10f, 0.10f, 0.10f);
glVertex3f(-0.10f,-0.10f, 0.10f);
glEnd();
The above code works like its supposed to, it puts a quad
on the screen but when I change it to this:
glBegin(GL_QUADS);
// TotalVertex is 3. The vertices are in clock-wise order
for (int i = 0; i <= polygon.TotalVertex; i++)
glVertex3f(polygon.vertex[i].x,
polygon.vertex[i].y,
polygon.vertex[i].z );
glEnd();
I don't get anything on the screen!! Its supposed to put a
whole scene on the screen.
Help! I can't find whats wrong. I tried to unloop them
and just write the 4 glVertex3f without using the for loop.
this is the code that calls the function above
OBJECT * object;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLoadIdentity( );
for ( int i = world->NumObjects; i >= 0; i-- ) {
object = &world->object[i];
for (int e = 0; e <= object->NumSurface; e++) {
texture= object->texture;
polygon = object->surface[e];
PolygonRend();
}
}
SDL_GL_SwapBuffers( );
[edited by - creativeminds on May 1, 2002 5:15:48 PM]