glBindTexture issues

I have a program that gives crashes with the “0xc0…05 Access Violation” whenever I make a call to glBindTexture at a certain point in the program. It is important to note that glBindTexture is called twice in the program, and even if one comments out the first call, the second one always works. The only thing that I understand could be wrong is that the identifier is 0 or <0, but given that I use glGenTextures that shouldn’t be the case. So, has anyone else experienced something like this, or if not at least know the cause of what is happening? Any and all replies are welcome.

I just had the exact same problem today working on my project for Computer Graphics.

The first thing I’d do is make sure you are not trying to load a texture that doesn’t exist. If you are using a loop, make sure it doesn’t loop one extra time. That would cause the problem.

Try running your program through a debugger and insert breakpoints into the loadtexture function. You’ll have a better idea of what’s happening when it crashes.

I think the error come from glTexImage2D.

Make sure its NOT in a glBegin(blah)-glEnd(). I dont think that works