PDA

View Full Version : 1D Textrue



LLM
06-06-2006, 01:02 AM
my fragment shader is :

uniform sampler2D Data;
uniform sampler1D transfer;
void main()
{
gl_FragColor.rga = texture2D(Data,gl_TexCoord[0].st).rga;
gl_FragColor.b = texture1D(transfer,gl_TexCoord[1].s).b;
}in my Render function:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, Texture2D);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_1D, Texture1D);

glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(5.0, 0.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(5.0, 5.0, 0.0);
glTexCoord2f(1.0, 0.0);
glVertex3f(0.0, 5.0, 0.0);
glEnd();But the quad is invisible. why?

LLM
06-06-2006, 01:40 AM
I found my problem. I forgot to use glUniform1i()