So i cant get my shader to render with color. My shader works when i dont set the color using the attribute Color. my code for vertex is:
typedef struct
{
GLKVector3 Position; //Position
GLKVector4 Color; //32 Bit color
GLKVector3 Normal; //For Lighting
GLKVector2 TexCoord; //For Texturing
} Vertex;
I have given the colors for all vertices as [1,0,0,1] My vertex shader is this:
attribute vec3 Position;
attribute vec4 Color;
attribute vec3 Normal;
attribute vec2 TexCoord;
uniform mat4 ModelViewMatrix;
uniform mat4 ProjectionMatrix;
varying vec4 DestinationColor;
void main(void)
{
gl_Position = ProjectionMatrix*ModelViewMatrix*vec4(Position,1);
DestinationColor = Color;
}
And my Fragment Shader is this:
precision mediump float;
varying lowp vec4 DestinationColor;
void main (void)
{
gl_FragColor =DestinationColor;
}
And it Displays nothing.
It doesnt even work if i change the fragment shader to say gl_FragColor = vec4(1,0,0,1); Unless i uncomment the line in vertex shader setting the DestinationColor.
Please help i have been sitting on this for a while now