I have a set of shaders for textures, and to handle the camera position and view. I would like to blend the color specified below with the texture color.
listIndex = GL11.glGenLists(1);
GL11.glNewList(listIndex, GL11.GL_COMPILE);
GL11.glBegin(renderType());
for (int i = 0; i < size(); i++)
{
Vector3 v = get(i);
Vector2 t = getTex(i);
Color c = getColor(i);
GL11.glColor3f(c.fr(), c.fg(), c.fb());
GL11.glTexCoord2f(t.x, t.y);
GL11.glVertex3f(v.x, v.y, v.z);
}
GL11.glEnd();
GL11.glEndList();
Using the above code, the texture displays properly, but the color is ignored.
Old Texture Vertex Shader
uniform mat4 projection;
uniform mat4 view;
void main()
{
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = projection * view * gl_Vertex;
}
Old Texture Frag Shader
uniform sampler2D texture1;
void main()
{
gl_FragColor = texture2D(texture1, gl_TexCoord[0].st);
}
What I have tried:
Vertex Shader:
uniform mat4 projection;
uniform mat4 view;
varying vec4 vColor;
void main()
{
vColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = projection * view * gl_Vertex;
}
Fragment
uniform sampler2D texture1;
varying vec4 vColor;
void main()
{
gl_FragColor = texture2D(texture1, gl_TexCoord[0].st) * vColor;
}
The color of the texture remains the same as before.