Sign in to follow this  

How to Map Quad to Viewport Area

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Uh, use an ortho projection and position the quad at the edges of your ortho view?

Incidentally the viewport is independant of your view - rendering gets scaled to fit the current viewport. So if it takes up all of the screen then it'll take up all of the screen regardless of how big or small the viewport is.

Share this post


Link to post
Share on other sites
e.g.


void GoOrtho(int w, int h)
{
glPushMatrix();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0,w,0,h,0,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}



And then set your vertices of your quad to the 4 edges of the screen. :)

Share this post


Link to post
Share on other sites
Also, not sure about PC/OpenGL (may vary with graphics card / filtering type etc, not 100% sure) but on some platforms you need to offset the positions of your quads vertices by half a pixel so that the texture filtering doesn't adversely affect your screen-mapped quad.

e.g. Rather than one corner being (0,0) and opposite being (width,height), make them (0 - 0.5, 0 - 0.5) and (width - 0.5, height - 0.5).

Share this post


Link to post
Share on other sites

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this