PDA

View Full Version : Ask for a function about dealing with bitmap



07-17-2004, 07:36 PM
My perpose is to load a bitmap into memory and use procedure "glDrawPixels" to display the image in RC. Now I use Windows API function "LoadImage" to load. But it comes up a problem. In bitmap the color sequence is R-G-B, while OpenGL procedure deal with in B-G-R. Though I can change it in program, it seems redundant to do so because there's must such a function existed. Is here anyone tell me?Thanks a loooooooooooot!

07-17-2004, 07:51 PM
maybe the function i find is auxDIBImageload.
But where can I find the detail description of it?

Fahrenheit451
07-17-2004, 08:03 PM
Not sure if it answers your question, but glDrawPixels will take a format parameter of either GL_BGR or GL_RGB/GL_RGBA. Use whichever suits the image data you have. I think GL_BGR is windows o/s only, which also makes me think that it's the opposite way around in that bmp files are BGR ordered and OpenGL calls are RGB.

07-21-2004, 02:25 AM
Thank you very much.
But I can't found the const GL_BGR in glDrawPixels. I use Delphi6.0 to develop the program. The parameters I could use are GL_COLOR_INDEX, GL_STENCIL_INDEX, GL_DEPTH_COMPONENT, GL_RGBA, GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_LUMINANCE, and GL_LUMINANCE_ALPHA. Could you tell me how to solve this problem???