Hello, I am a hobbyist programmer who uses CodeBlocks and MingW32 on Windows XP. I am wondering where I could go to find out how to set up a 2d OpenGL context. This works fine for me:
if (h <= 0)
{
h = 1;
}
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0f, float(w) / float(h), 1.0f, 100.0f);
//gluOrtho2D() would go here instead of gluPerspective,
//jah?
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
followed by:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
gluLookAt(0.0, 0.0, 1.74,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
However, I’ve read elsewhere that setting up a 2D context can increase speed, and I’m thinking about experimenting with some 2D animation to see how much faster it is than SDL_BlitSurface() type animation. So…what gives? As in, where do I go to see a 2D setup or how would I modify the code above? Also, can I keep using glVertex2f() functions for drawing in a 2D context or would I have to get into glVertex2d()? It doesn’t seem like it, considering the “2” should be the operative point there. Thx in advance for any responses! -B