0
votes

I'm loading raw texture (with alpha channel) and displaying it in openGL everything is fine and texture displayed, but color is little bit darker than original. I already tried to turn of lighting, blending and dithering, but this doesn't helps.

I'm using mac osx.

Sample image

Sample imagehttp://postimage.org/image/2wi1x5jic/

Here's openGL texture loading source code:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA , width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &bytes[0]);

EDIT:

Thats very weird, I used example from http://forums.tigsource.com/index.php?topic=9560.0 and received same glitch ... So the problem not im my code, maybe driver options? Hm ...

SOLUTION:

Thanks @datenwolf, images were saved with sRrgb color profile. Problem is solved once I removed it and converted to RGB.

1
How are you viewing the original image?Nicol Bolas
I'm using Gimp, raw image formatlameDay

1 Answers

2
votes

Maybe you have GL_MODULATE set as texturing environment and the vertex colours are not white. Try setting the texture environment to GL_REPLACE.

glBindTexture(GL_TEXTURE_2D, your_texture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

EDIT

Another problem may be a color profile embedded into the image. A image viewer may use this colour profile to implement color management, adjusting the colours for your monitor's colour profile. OpenGL as-it-is doesn't do color management; there is a extension, that framebuffers and textures are sRGB, this is kind of the smallest common denominator of colour management. But then you'd still have to transfer your input images to sRGB colour space.

I've a lengthy article in preparation the explains in depth how to do colour management with OpenGL. But it's far from complete.