Vanishing point other than center?
I was playing XWing vs. TIE Fighter the other day and realized that the vanishing point for the rendered graphics is above the center of the screen. Which is nice, because the lower part of the screen is taken up by a readout, so having the vanishing point up higher allows you to see the action below the reticle as much as above and makes it easier to keep what you are firing at in view.
My question is, OpenGL has always put the vanishing point at the exact center of the viewport.
Does moving the vanishing point around require a particular setting of the viewpoint or a special setup of the frustum?
Sorry, I can''t try this out right now, I''m just posting it while I''m curious, plus it might help others with the same question. Thanks!
Let w, and h be height and with of the total screen and v be the ''vanishing point''
glViewport(v.x - w/2, v.y - w/2, v.x + w/2, v.y + w/2);
glViewport(v.x - w/2, v.y - w/2, v.x + w/2, v.y + w/2);
Ah, cool, so it is a glViewport operation. Thank you.
I assume you mean by 'total screen' that some of it could actually be off the visible monitor screen, which forces the vanishing point around.
And actually, I think the call should be glViewport(v.x-w/2, v.y-h/2, w, h) since the prototype for glViewport is:
[edited by - Waverider on August 6, 2003 5:54:33 PM]
I assume you mean by 'total screen' that some of it could actually be off the visible monitor screen, which forces the vanishing point around.
And actually, I think the call should be glViewport(v.x-w/2, v.y-h/2, w, h) since the prototype for glViewport is:
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
[edited by - Waverider on August 6, 2003 5:54:33 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement