[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: OpenGL orthographic projection
On Sunday 25 July 2004 18:45, Steve Baker wrote:
> Gregor Mückl wrote:
> > glMatrixMode(GL_MODELVIEW);
> > glLoadIdentity();
> > glPushMatrix();
> > glOrtho(-3,3,3,-3,-20,20);
>
> You havn't set the projection matrix - so probably there is still a
> perspective matrix there.
>
Yes, that was the error.
> I would do this:
>
> glMatrixMode(GL_PROJECTION);
> glLoadIdentity();
> glOrtho(-3,3,3,-3,-20,20);
> glMatrixMode(GL_MODELVIEW);
> glLoadIdentity();
>
> Also, you'll probably want to do a glDisable(GL_DEPTH_TEST) because
> you probably still have it turned on from the 3D rendering part of your
> code.
>
Yes, GL_DEPTH_TEST is still turned on. Thanks for pointing that one out.
However, I have only a limited set of fixed geometry with a distance from the
camera which is larger than that of the mouse cursor. Unless the contents of
the z buffer could change its meaning radically when switiching projection
matrix this should not be a problem. I understand that the z buffer layout
depends on the near and far clilpping plane distance in projection mode, so I
don't know how the graphics card will actually behave with respect to the z
buffer.
Regards,
Gregor