I’m having some trouble with binding textures to glslang shaders. Because of the very separated nature of the code that is doing this, I can’t post all of it, but I do have a glIntercept trace of a frame loop. The program of interest is program id 12:
wglSwapBuffers(0x87010b46)=true
glClearColor(1.000000,1.000000,1.000000,1.000000)
glClearDepth(1.000000)
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT)
glDisable(GL_DEPTH_TEST)
glDepthMask(false)
glEnable(GL_SCISSOR_TEST)
glViewport(0,0,640,480)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0.000000,640.000000,480.000000,0.000000,-1.000000,1.000000)
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glLoadIdentity()
glLoadMatrixf([1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,1.000000])
glUseProgram(15)
glGetAttribLocation(15,"position2d")=0
glEnableVertexAttribArray(0)
glBindBuffer(GL_ARRAY_BUFFER,6)
glVertexAttribPointer(0,2,GL_FLOAT,false,32,0x0000)
glBindBuffer(GL_ARRAY_BUFFER,0)
glGetAttribLocation(15,"color")=1
glEnableVertexAttribArray(1)
glBindBuffer(GL_ARRAY_BUFFER,6)
glVertexAttribPointer(1,4,GL_FLOAT,false,32,0x0010)
glBindBuffer(GL_ARRAY_BUFFER,0)
glDrawArrays(GL_POLYGON,0,4) GLSL=15 Textures[ (0,1) ]
glGetAttribLocation(15,"position2d")=0
glDisableVertexAttribArray(0)
glGetAttribLocation(15,"color")=1
glDisableVertexAttribArray(1)
glUseProgram(0)
glScissor(0,0,640,480)
glBindBuffer(GL_ARRAY_BUFFER,2)
glMapBuffer(GL_ARRAY_BUFFER,GL_WRITE_ONLY)=0x3040090
glUnmapBuffer(GL_ARRAY_BUFFER)=true
glBindBuffer(GL_ARRAY_BUFFER,0)
glGetUniformLocation(12,"tex1")=0
glLineWidth(30.000000)
glUseProgram(12)
glEnable(GL_TEXTURE_1D)
glActiveTexture(GL_TEXTURE0)
glBindTexture(GL_TEXTURE_1D,1)
glUniform1iARB(0,0)
glGetAttribLocation(12,"position2d")=0
glEnableVertexAttribArray(0)
glBindBuffer(GL_ARRAY_BUFFER,2)
glVertexAttribPointer(0,2,GL_INT,false,16,0x0000)
glBindBuffer(GL_ARRAY_BUFFER,0)
glGetAttribLocation(12,"texCoord1d")=2
glEnableVertexAttribArray(2)
glBindBuffer(GL_ARRAY_BUFFER,2)
glVertexAttribPointer(2,1,GL_FLOAT,false,16,0x0008)
glBindBuffer(GL_ARRAY_BUFFER,0)
glGetAttribLocation(12,"color")=1
glEnableVertexAttribArray(1)
glBindBuffer(GL_ARRAY_BUFFER,2)
glVertexAttribPointer(1,4,GL_UNSIGNED_BYTE,true,16,0x000c)
glBindBuffer(GL_ARRAY_BUFFER,0)
glDrawArrays(GL_LINES,0,2) GLSL=12 Textures[ (0,1) ]
glGetAttribLocation(12,"position2d")=0
glDisableVertexAttribArray(0)
glGetAttribLocation(12,"texCoord1d")=2
glDisableVertexAttribArray(2)
glGetAttribLocation(12,"color")=1
glDisableVertexAttribArray(1)
glUseProgram(0)
glLineWidth(1.000000)
glEnable(GL_DEPTH_TEST)
glDepthMask(true)
glMatrixMode(GL_MODELVIEW)
glPopMatrix()
wglSwapBuffers(0x87010b46)=true
The fragment shader is:
uniform sampler1D tex1;
varying vec4 fragColor;
varying float fragTexCoord1;
void main()
{
gl_FragColor = texture1D(tex1, fragTexCoord1);
}
Now, I have verified that the texture coordinate is correct (by using gl_FragColor = fragTexCoord1). I have also verified that the texture’s data is correct (glIntercept’s reflection mode). I do not know what it is that I’m not doing.
Any ideas? Am I forgetting some texture parameter or something?