apapaxionga
11-03-2011, 05:00 AM
I use a texture to keep the position of a cube.
if i define the texture like:
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,2,2,0,GL_RGBA ,GL_UNSIGNED_BYTE,edge);
Then i have to mutiply 255 to get the correct position in the Vertex Shader
pos.xy = tex2D( tex , float2(0.0,1.0) ).rg*255;
However if i define the texture like that :
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA32F,2,2,0,GL_R GBA,GL_FLOAT,edgefloat);
pos.xy = tex2D( tex , float2(0.0,1.0) ).rg
Then i do not have to mutiply 255 to get the correct position.
Why???
if i define the texture like:
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,2,2,0,GL_RGBA ,GL_UNSIGNED_BYTE,edge);
Then i have to mutiply 255 to get the correct position in the Vertex Shader
pos.xy = tex2D( tex , float2(0.0,1.0) ).rg*255;
However if i define the texture like that :
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA32F,2,2,0,GL_R GBA,GL_FLOAT,edgefloat);
pos.xy = tex2D( tex , float2(0.0,1.0) ).rg
Then i do not have to mutiply 255 to get the correct position.
Why???