Drawing to pixel scale?
I want to be able to draw shapes to pixel scale. That is to say, when I write: glVertex3f(-16.0f, -16.0f, 0.0f); I want that point to be exactly 16 pixels down ont he x and y axi. Thre more of these would draw a 32x32 square.
I came across the gluOrtho2D(0, 1024, 0, 768); function, but I'm not really sure how to use it, or where in my code to place it.
Any and all help is welcomed. Thanks in advance for any aid you provide ^^
Meow.
That function modifies the PROJECTION matrix. Place it before the viewing transformation and before you draw any objects.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 1024, 0, 768);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//apply viewing transformation
//draw objects
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, 1024, 0, 768);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//apply viewing transformation
//draw objects
deathkrushPS3/Xbox360 Graphics Programmer, Mass Media.Completed Projects: Stuntman Ignition (PS3), Saints Row 2 (PS3), Darksiders(PS3, 360)
May 21, 2006 11:41 AM
Make sure that the width and height are your actual program dimensions, not just 1024 and 768.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement