I have a pointer to a luminance+alpha float32 array;
I want to store it in a gpu texture as GL_LUMINANCE_ALPHA16F_ARB
then display luminance+alpha through a glsl fragment shader.
My texture is defined as follow:
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA16F_ARB, 2048, 2048, 0, GL_LUMINANCE_ALPHA, GL_FLOAT, 0);
Then when needed, I transfer part of my array from RAM to VRAM like this:
glTexSubImage2D(GL_TEXTURE_2D,0,0,0,width,height,GL_LUMINANCE_ALPHA,GL_FLOAT,data);
Here’s the fragment shader I use to display luminance and alpha as red and green:
gl_FragColor = vec4(texture2D(source, gl_TexCoord[0].xy).xy,0.,0.);
However something is obviously wrong, the first thing being that red=green=only one value, where I’m expecting 2 separate values.
-Is there something specific to deal with luminance alpha texture in glsl ?
-Am I ok with the other parts of the code ? (glTexImage2D/glTexSubImage2D)
Thanks
(I’m using GeForce GTX 260 with latest drivers on Windows 7)