Realistic Perspective
Hi,
I just started OpenGL as i have said before in another forum and i''m stuck. When one of my objects passes a certain Z coordinate it just varnishes, it doesn''t get smaller like it should to make it look realistic. It just disappears. Anyone got any ideas?
Mike
First guess - your viewing distance/the far plane of the viewport is set too close. Check out gluPerspecive() and its arguments. As I said, this would just be my first guess as what you said is pretty vague.
Crispy
Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
1st i type:
''glMatrixMode(GL_PERSPECTIVE);''
2nd i type:
''glViewport(0, 0, Window->ClientWidth, Window->ClientHeight);''
lastly i type:
''glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 100.0);''
before all this i have functions like:
''glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );''
-- and --
''glLoadIdentity();''
''glMatrixMode(GL_PERSPECTIVE);''
2nd i type:
''glViewport(0, 0, Window->ClientWidth, Window->ClientHeight);''
lastly i type:
''glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 100.0);''
before all this i have functions like:
''glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );''
-- and --
''glLoadIdentity();''
Mike
Ok, you''re doing 2d, not 3d!
Put very simply, gluPerspective operates on 3d space, glFrustum on 2d.
Increase the last parameter of glFrustum() to something like 1000.0 etc
Regards
Put very simply, gluPerspective operates on 3d space, glFrustum on 2d.
Increase the last parameter of glFrustum() to something like 1000.0 etc
Regards
Hang on a moment ...
Are you trying to do 2D or 3D?
The line
glMatrixMode(GL_PERSPECTIVE);
should read
glMatrixMode(GL_PROJECTION);
You should check out the tutorials at nehe.gamedev.net for info on how to set up an opengl window
Regards
Are you trying to do 2D or 3D?
The line
glMatrixMode(GL_PERSPECTIVE);
should read
glMatrixMode(GL_PROJECTION);
You should check out the tutorials at nehe.gamedev.net for info on how to set up an opengl window
Regards
Opps...
I really ment to say:
''glMatrixMode(GL_PROJECTION);''
i just got mixed up and i am doing 3d.
I really ment to say:
''glMatrixMode(GL_PROJECTION);''
i just got mixed up and i am doing 3d.
Mike
Do you call glMatrixMode(GL_MODELVIEW) when you''re done? If you don''t, that glLoadIdentity is going to undo all that stuff you did to the projection matrix.
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement