View Full Version : Getting viewport boudries

07-17-2009, 11:35 AM
I am trying to draw an object at the top of my view port. To get the view port dimensions I do the following:

GLuint viewport[4];
glGetIntegerv( GL_VIEWPORT, viewport );

After this call I expect the (y + height) to be the top of my view port but when I try to draw the object just below that it's out of my view.

What am I doing wrong?


07-17-2009, 12:35 PM
I try to draw the object just below

Does below mean the top edge of your view port ??

it's out of my view

Where is your camera centered? At the front or behind your object???

Where is your camera pointing to ???

Refer to gluLookAt() parameters.

If you are sure you are drawing at a correct place inside the viewport quad, then other reason can be that your far plane is in front of the object's center.

In summary, just cross check your camera parameters with that of the object.

07-17-2009, 01:17 PM
Yes.. I'm trying to draw to the top edge of the view port. Also if I set my vertical location to 0 then the object is drawn to the bottom of the view, which is expected, so I know the camera is positioned properly.

07-17-2009, 01:37 PM
ok. => your camera is facing your object.
and that your object is in the view frustum.

Can I look at your camera settings and the view port?