Advertisement

Perspective question

Started by September 26, 2003 05:07 PM
3 comments, last by oroussea 21 years, 5 months ago
Hello Im trying to make a horizontal shooter a la R-Type, Gradius, etc. I load my model (spaceship) at coord 0, 0, 0. My problem is that when i translate the ship, i see the "perspective" (if it moves left, the front of the ship is visible, right, the ship''s engine are visible) i dont want that i want the ship to stay "still". init: glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(90.0f,(GLfloat)width/(GLfloat)height, .5f ,1024.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); rendering: gluLookAt(0, 0, 300, 0, 0, 0, 0, 1, 0); glTranslatef(xpos,0,0); thanks -Oli
glOrtho(...);

I think this will do

www.cppnow.com
Advertisement
Where?
Instead of what line?

thanks for the quick reply

-Oli
The problem is that the call to gluPerspective sets up a 'perspective' projection matrix. What you seem to want is an Orthographic matrix. So you would switch gluPerspective() to glOrtho().

void glOrtho(  GLdouble left,    // left clip plane  GLdouble right,   // right clip plane  GLdouble bottom,  // bottom clip plane  GLdouble top,     // top clip plane  GLdouble near,    // near clip plane  GLdouble far      // far clip plane); 


Edit: added code tags

[edited by - jwace81 on September 26, 2003 7:03:14 PM]
Made various tests and it works!! :D
thanks to all of you who replied and helped me out!

-Oli

This topic is closed to new replies.

Advertisement