How can I set color for vertex in opengl es 2.0?
Now I use color array:
float[] TriangleColors = new float[]{
1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
};
GL.EnableVertexAttribArray((int)GLKVertexAttrib.Color);
GL.VertexAttribPointer((int)GLKVertexAttrib.Color,
3, VertexAttribPointerType.Float,
false, 0, 0);
GL.GenBuffers(1, out colorBuffer);
GL.BindBuffer(BufferTarget.ArrayBuffer, colorBuffer);
GL.BufferData (BufferTarget.ArrayBuffer,
(IntPtr)(TriangleColors.Length * sizeof(float)),
TriangleColors,
BufferUsage.StaticDraw);
This code doesn't work for me.