SOLVED
I've been following several tutorials on OpenGL and I cannot for the life of me get the texture to show up. can someone let me know what I'm doing wrong?
Edit for more clarity: I get a white box. So I can see the quad, but not the texture that should be on top of it. I am using Visual Studio 2010 for compilation and freeGLUT for handling the windowing API.
Edit: glGetError returns 1282 from the start of main until the first call in the resize function.
My load texture function: char* fileName = "..\\Assets\\ARG.bmp";
I'm uncertain of the paramters for LoadDIBitmap(), but I presume that BitmapInfo contains all the pertinent information regarding texture width and height, and it returns a pointer to memory allocated and has the texture information in it.
Have you used your debugger to check the contains in the memory location returned and check it actually contains the bitmap data you're expecting?
Also Bitmaps don't have an alpha channel, so the format you should be passing to glTexImage2D() should be either GL_RGB or GL_BGR_Ext (I believe BMP's store the channels in reverse order so BGR not RGB)
Also, does textures[0] contain a non-zero value?
Try adding in some glGetError() after each call to see exactly what line it's failing on.
I'm uncertain of the paramters for LoadDIBitmap(), but I presume that BitmapInfo contains all the pertinent information regarding texture width and height, and it returns a pointer to memory allocated and has the texture information in it.
Have you used your debugger to check the contains in the memory location returned and check it actually contains the bitmap data you're expecting?
Also Bitmaps don't have an alpha channel, so the format you should be passing to glTexImage2D() should be either GL_RGB or GL_BGR_Ext (I believe BMP's store the channels in reverse order so BGR not RGB)
Also, does textures[0] contain a non-zero value?
Try adding in some glGetError() after each call to see exactly what line it's failing on.
I think loading the texture is not the problem. I have changed it back to GL_RGB.
I am getting error number 1282 after the call to glEnd()
[quote name='Kurt Blanken' timestamp='1309392972' post='4829328']
After some debugging I am back to "no clue." glGetError returns 1282 all over the place.
Which line is the very first time it reports an error?
[/quote]
As far as I can tell it has that value when it enters main, and stays that way until it calls resize for the first time.
If it is possible that something wrong somewhere else (glut calls, linking, etc) could cause textures to not work but still be able to draw polygons, I can show the rest of the code as well.
Post the rest of the code. I have a strong feeling that you're doing all the initialization before you have a rendering context to operate on if you're getting that error all over the place.