bool InitGL(SDL_Surface *S)
{
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearDepth(1.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST); // Enable Depth Testing
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Set Perspective Calculations To Most Accurate
return true;
}
...
if (Keys[SDLK_LEFT])
angle += (float)(Milliseconds) / 5.0f;
if (Keys[SDLK_RIGHT])
angle -= (float)(Milliseconds) / 5.0f;
glRotatef(angle, 1.0f, 1.0f, 1.0f);
glBegin(GL_TRIANGLES);
glVertex3f(-1.0f, -1.0f, 0.0f);
glVertex3f(0.0f, 1.0f, 0.0f);
glVertex3f(1.0f, -1.0f, 0.0f);
glEnd();
Well it works but with some angles, perspective becomes odd, look at this screenshot. Why ?
[edited by - Esprit on March 15, 2003 10:45:50 AM]
[SDL] Perspective oddie
look at this code
Adrien Constant
It seems the triangle is being clipped by the near clip plane. Try moving the triangle farther away or moving your near plane closer to the screen (gluPerspective)
baumep
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement