PDA

View Full Version : gluOrtho and perspective



hellox
04-10-2003, 01:58 PM
Hello =) iam trying to make a view of an object in 2d, the problem is that i cant get the view math to work... i want to put the x=o and the y=0 values on the top-left corner of the screen, my code is:

void ReSizeGLScene(int Width, int Height)
{
if (Height==0)
Height=1;

glViewport(0, 0, Width, Height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();

//gluPerspective(45.0f,(GLfloat)Width/(GLfloat)Height,0.1f,100.0f);
gluOrtho2D(0,(GLdouble)Width,0,(GLdouble)Height);
glMatrixMode(GL_MODELVIEW);
}

i think the values at gluOrtho2D are ok but i cant see the object, if i use the gluPerspective i can! Iam running under mandrake 9.0 linux but i think theres nothing to do with it.

Does any one know the problem?

Thanks =)
hellox from PT

shinpaughp
04-10-2003, 02:51 PM
If you can see them with gluPerspective but not with gluOrtho2D then you must be either setting your vertices with a z coord less than or equal to -0.1 and most likely less than -1.0. Are you using glVertex3 or glVertex2? Are you calling gluLookAt anywhere in your code?