This is part of my texture loading routine:
GLuint id = -1; //id always > 0 && < 20 glGenTextures(1, &id ); glBindTexture( GL_TEXTURE_2D, id ); //er always 0 GLenum er = glGetError(); //p always non NULL const float* p = new float[4*256*256]; glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA32F_ARB, 256,256, 0, GL_RGBA, GL_FLOAT, p ); delete p;
It works. But later in my program I create multiple threads, bind the ogl context to one of them, and much more. After which calling the same code above I get access violation at glTexImage2D().
After much experimentation, if the second time I create p with approximately at least as large as this:
const float* p = new float[44256*256 - 50000];
I do not get access violation.
Both times glGetError() returns 0; p is not NULL; and the texture id is valid, which I call glDeleteTextures() when no longer used.
I do not exclude memory leaks/corruptions. But since p is a successfully created new buffer, where in glTexImage2D() can the access violation be occurring?
If the prob is due to hglrc context, wouldn’t I receive a error for glGetError()?