Gamma Correction

Hey guys,



I have a question regarding gamma correction when reading texture files.



My textures are stored in non-linear space and so when I read them in I need to convert them to linear space before doing my lighting calculations. I can do this in my shader with:

[java]

vec4 texColor = texture(m_Texture, texCoord);

texColor.xyz = pow(texColor.xyz, 2.2);

[/java]



However according to the OpenGL spec, I can used sRGB textures and the hardware will perform this conversion for me automatically:

[link]http://www.opengl.org/sdk/docs/man/xhtml/glTexImage2D.xml[/link]



I did a search in the JME code and found nowhere that GL.GL_SRGB8_ALPHA8 is being used.



So my question is:

Does JME have a way for me to tell it that a Texture is sRGB and thus when I use the texture(tex, coords) function in the shader, OpenGL will automatically apply the gamma correction?

not sure it works like that.

look at this thread

http://hub.jmonkeyengine.org/groups/general-2/forum/topic/blending-textures-with-vertex-colors/?topic_page=2&num=15

@remorhaz gave valuable insight about gamma correction and how he was using it with JME.

There are also source articles about gamma correction that are very interesting.