Advertisement

3d perspective

Started by March 04, 2002 03:38 AM
3 comments, last by element2001 22 years, 11 months ago
I have a simple question, being a noob I wonder if there is a way to change the perspective of OpenGL, or is it set to a certain amount. What I mean is when a polygon is drawn further into the screen it gets smaller. Is this adjustable? Or is it always going to get smaller the same amount? (given same distance) To be more specific (if need be) I''m drawing a scene. and the stuff in the foreground looks ok, but the polys further back look much smaller. if this is the way it is supposed to be thats fine, but if it''s adjustable I''d like to tinker with it.
Yes you can change the perspective.
You need to change the projection matrix.

Actually, what are the lines of code you''re calling just after the line "glMatrixMode(GL_PROJECTION)" ?
Advertisement
the lines I have are:
  	gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);		glMatrixMode(GL_MODELVIEW);								  


I see now it's the 45.0f I need to change right? and the 0.1f,100.0f are the near and far cliping planes?

Thanks Vincoof, you steered me in the right direction. now to tinker with it.

Edited by - element2001 on March 4, 2002 1:27:42 PM
Yes that''s it.
Well done

You have to take care of the usage, though. Because tweaking the field of view gives the feeling that the scene becomes more or less wide.
Original post by element2001
    	gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);		glMatrixMode(GL_MODELVIEW);						  


Clear the old matrix because the new one is multiplied by the old. The code should be:

  glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);	glMatrixMode(GL_MODELVIEW);  


Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.

This topic is closed to new replies.

Advertisement