fireshadow4126's picture

Texturing Troubles


I'm running into some slight trouble with texturing. I've copied the OpenGL/1.x/Textures example exactly (except for a different texture and the use of VBOs, but these are definitely not the problem). However, when I run it, the quad shows up exactly where it should be, but it is rainbow colored instead of having the texture I supplied. Any ideas as to what might cause this?

Thanks in advance!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

This usually happens when the width, height or TextureFormat parameters for GL.TexImage2d are incorrect. Make sure you use the same parameters across both Bitmap.LockBits and GL.TexImage2d (i.e. don't use a 16bpp format in LockBits and a 32bpp in TexImage2d). Also try using a different image file, just to exclude the chance it might be a loading/decoding issue.

fireshadow4126's picture

The parameters were mismatched, but fixing that didn't solve the problem, and neither did changing the image.