problem with drawing gif images

hi everyone, I made a simple program to draw an image, I’m using C# so I convert an image file to a bitmap in .Net then use Bitmap.LockBits and glDrawPixels to draw the image. But I can draw .gif images successfully the first time only, from the second time (I changed its raster position) I’ll get a completely black screen.

With .jpg or .png or .bmp I got no such problem.

Does any one having same problem with me ? Thanks for any help.

Maybe I don’t know how to draw color-indexed images in OpenGL so it caused the problem ?

Right now I have no idea why displaying gif pictures does not work for you but I advise you to write the loaded gif image data into another picture format like png (very straightforward with libpng).

This way, you can check your gif loader produces valid data before trying to feed it to opengl.

I have checked it again, this is not a bug with OpenGL, maybe somewhere else in my code. Anyway, many thanks.