View Full Version : Loading Sun Raster images
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.
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?
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.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.