Weird issue. Seems like my GLSL program is behaving different than logic and the spec suggest. Here's the vert shader:
#version 120
uniform mat4 q;
varying vec2 TextureCoord;
void main()
{
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
vec4 p = q*gl_Vertex;
TextureCoord = vec2(.01f,.01f);
gl_Position= gl_ModelViewProjectionMatrix*p;
gl_PointSize = gl_Normal.x / -p.z;
}
And here's the frag shader:
#version 120
uniform sampler2D theTex;
varying vec2 TextureCoord;
void main()
{
vec2 realTexCoord = ( gl_TexCoord[0].st*vec2(0.024f,0.024f)) + TextureCoord;
gl_FragColor = gl_Color*texture2D(theTex, realTexCoord);
}
The wrinkle is this. If I drop the + TextureCoord in the frag shader and replace it with some constant vec2 like (.1f,.1f) everything's fine, I see the texture. But like this, I just get weird garbage color noise. This is GL_POINTS with smooth points and texture coordinate replacing on. I'm using the TexCoord[0].st because gl_PointCoord is always zero...
What it looks like is happening is junk values are somehow getting into my varying in between. But how would this happen? And if these values are somehow being 'interpolated' between the vertex and fragment shaders, what sort of logic is applied?
I tried sending the values in on a uniform, but it too is always zero.
I'm using LWJGL.