Advertisement

[SDL] Perspective oddie

Started by March 15, 2003 09:27 AM
1 comment, last by Esprit 21 years, 11 months ago
look at this code

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]
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
Advertisement
Yes you must be right, I''m going to try this.
Adrien Constant

This topic is closed to new replies.

Advertisement