2D graphics in OpenGL?
How do I load a controllable 2D graphic(BITMAP) into open gl, and if I do lod it would I control the same as I would a 3d object, as in making it move and setting xpos ect.
"He who fights monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you."~Friedrich Nietzsche
"He who fights monsters should look to it that he himself does not become a monster... when you gaze long into the abyss, the abyss also gazes into you."~Friedrich Nietzsche
Firstly, I''m drunk, so please excuse me if this is TOTALLY worng!! LoL!!! (Third post this evening!!! (back from pub you see! )
But to set up a 2d projection use.....
// Switch to Ortho view
glMatrixMode(GL_PROJECTION);
// Select The Projection Matrix
glPushMatrix();
// Store The Projection Matrix
glLoadIdentity();
// Reset The Projection Matrix
glOrtho(0,800,0,600,-1,1);
// Set Up An Ortho Screen
glMatrixMode(GL_MODELVIEW);
// Select The Modelview Matrix
glPushMatrix();
// Store The Modelview Matrix
glLoadIdentity();
// Reset The Modelview Matrix
// *********************8
// DRAW YOUR 2D STUFF
// Using glTranslatef(X,Y,whatever (preferably zero)
// ***********************
// Then................
// Switch back to Perspective view
glMatrixMode(GL_PROJECTION);
// Select The Projection Matrix
glPopMatrix();
// Restore The Old Projection Matrix
glMatrixMode(GL_MODELVIEW);
// Select The Modelview Matrix
glPopMatrix();
// Restore The Old Projection Matrix
But to set up a 2d projection use.....
// Switch to Ortho view
glMatrixMode(GL_PROJECTION);
// Select The Projection Matrix
glPushMatrix();
// Store The Projection Matrix
glLoadIdentity();
// Reset The Projection Matrix
glOrtho(0,800,0,600,-1,1);
// Set Up An Ortho Screen
glMatrixMode(GL_MODELVIEW);
// Select The Modelview Matrix
glPushMatrix();
// Store The Modelview Matrix
glLoadIdentity();
// Reset The Modelview Matrix
// *********************8
// DRAW YOUR 2D STUFF
// Using glTranslatef(X,Y,whatever (preferably zero)
// ***********************
// Then................
// Switch back to Perspective view
glMatrixMode(GL_PROJECTION);
// Select The Projection Matrix
glPopMatrix();
// Restore The Old Projection Matrix
glMatrixMode(GL_MODELVIEW);
// Select The Modelview Matrix
glPopMatrix();
// Restore The Old Projection Matrix
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement