Sign in to follow this  

making quad of exact size?

This topic is 4132 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

Well if you are working in 2D then this is easy because you specify the vertices in screen coordinates. This is practically impossible in 3D because the 'size' of the quad is determined by where the camera is.

Hope that helps,

Dave

Share this post


Link to post
Share on other sites
You want to do:


glViewport(0, 0, imageWidth, imageHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f, imageWidth, 0.0f, imageHeight);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex2i(0, 0);
glTexCoord2f(1.0f, 0.0f); glVertex2i(imageWidth, 0);
glTexCoord2f(1.0f, 1.0f); glVertex2i(imageWidth, imageHeight);
glTexCoord2f(0.0f, 1.0f); glVertex2i(0, imageHeight);
glEnd();



with your texture already set up. Make sure you use GL_NEAREST as your filter mode if you want to get pixel perfect (GL_LINEAR can blur your image very slightly).

Share this post


Link to post
Share on other sites

This topic is 4132 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