PDA

View Full Version : Loading Sun Raster images



lepp
06-23-2002, 02:09 PM
I have spent over a week trying to display a Sun Raster image. I have the image read into memory and when I display it on a window using glDrawPixels, I get a black square of the right width and height in the middle of the window. There are some dots of different colors where the image is being displayed but the image is almost entirly black. I can't for the life of me figure out what I am doing wrong. If anyone has any clue, I would be most grateful.

Thanks
LEPP

lepp
06-23-2002, 02:20 PM
I changed the Pixel format on the glDrawPixels() function to GL_LUMINANCE and the image appears in black and white. If I change it again to GL_GREEN then the image is black and green. When I change to GL_RGB or GL_RGBA, the image is almost entirely black with a couple of pixels of different colors. Any clue?

Thanks
LEPP

JML
06-24-2002, 02:25 AM
What is the storage format of the Sun Raster image as you have read it into memory?
Based on that, you can derive the correct glDrawPixels command. If the formats are not compatible, you will have to convert the image (either in memory or before reading) to a format that IS supported by glDrawpixels.

When you say it works for GL_LUMINANCE and GL_GREEN, but not GL_RGB, then that suggests that there is just one (1) color component in the Sun Raster image format, and that will most likely not work directly with a GL_RGB drawpixels (that one expects three components per pixel, not one).

Displaying the image in one (1) self-chosen color can be done by setting the active color with glColor() right before doing the glDrawPixels() with GL_LUMINANCE.

HTH

Jean-Marc.