Sign in to follow this  

making quad of exact size?

Recommended Posts

dave    2187
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,


Share this post

Link to post
Share on other sites
silothesuper    204
Oh lol, I see now :D. So when I set up a viewport for 2D, I would go like um:
gluOrtho2D(0, 800, 600, 0);
I was going putting something silly like
gluOrtho2D(-10, 10, -7.5, 7.5);

Thanks :D

Share this post

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

glViewport(0, 0, imageWidth, imageHeight);
gluOrtho2D(0.0f, imageWidth, 0.0f, imageHeight);

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);

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

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