I am binding a 3d and a 1d texture and am passing them to the fragment shader.
in my 1d texture are values saying how strong the values out of the 3d texture are weighted.
ie: color = ValueFrom1D * ValueFrom3D
when i display the color without “valuefrom1d” a color apperas, whereas when i mulitply it wiht “valuefrom1d” my screen stays black. first idea, the texture only has 0 in it. but it hasen’t.
in my main program i am setting up the texture coords to a quad.
glBegin(GL_QUADS);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 1.0);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 1.0);
glVertex3f(0.0, 0.0, 0.0);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0, 0.0);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, 0.0);
glVertex3f(0.0, size*1.0, 0.0);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0, 0.0);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 0.0);
glVertex3f(size*1.0, size*1.0, 0.0);
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0, 1.0);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, 1.0);
glVertex3f(size*1.0, 0.0, 0.0);
glEnd();
for that i am not sure if im am setting the GL_TEXTURE1_ARB up correctly (this is the 1d texture, array actually)
also i pass the coord on throgh my vertex shader.
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1] = gl_MultiTexCoord1;
in my understanding i should be able now to access the values of my 1d texture appropriatly in the fragment shader.
uniform sampler3D Texel;
uniform sampler1D Eigen;
void main(void)
{
vec3 texval;
vec3 color;
float eigen;
for(float i=0.0; i < 1.0; i+=1.0/200.0)
{
texval = texture3D(Texel, vec3((gl_TexCoord[0]).st,i)).rgb;
eigen = texture1D(Eigen, i);
color += texval*eigen;
}
gl_FragColor = vec4(color, 1.0);
}
the step of 1.0/200.0 is because the 3d texture is 200 layers deep and the 1 d texture has 200 entries, for each layer one.
but when i run the app like this only a black screen appears.
when i set the color to:
color += texval;
my values out of the 3d texture are summed up and displayed properly (not black)
now i am not quite sure if i map my texture coords properly