gl Current Context

Before you call anything in gl, do you need to set a glContext? What happens if you do not? For example, what would happen if I called glDeleteTextures(1,p) and I hadn’t selected a gl context? Is the texture name globally unique? If you call glGetError() without a context, what happens?

the glDeleteTextures shouldnt delete any texture ( those are context specific ) ans gor the glGetError, is it har to try it yourself??

Originally posted by Mazy:
is it har to try it yourself??

This situation is not one I’d want to ‘try myself’ because there are too many unknowns. For instance, if GetError doesn’t work outside a context, then DeleteTextures would apparently not cause an error etc.
I think it’s more complex than you realize.

[This message has been edited by mr_coolio (edited 02-25-2003).]

#include <GL/gl.h>

using namespace std;

void main()
cout << “0x” << hex << glGetError() << endl;


Looking in gl.h you find:

Man… was that tough to try out myself.

I don’t know if this has to do with anything, but I’ve experienced
problems before with setting the context, but only at the point of
destructing a RC.

Like, for example, I have 4 viewports, each with their own RC.
When I go to quit, I delete everything in OnDestroy(). But if
I try to do, something like:
wglMakeCurrent( m_pDC->GetSafeHdc(), m_hRC );

in OnDestroy before deleting all my textures and display lists,
the program immediately crashes at this line, every time. For
some reason, it works fine if I comment that line out. Both the
HDC and RC are perfectly valid, as I do test for NULL pointers.