View Full Version : Coloring quad vertices

08-03-2015, 02:32 PM
Is it possible to send color data for each vertex of a quad to the vertex shader without using VBOs?
E.g. by doing something like

glUniform4fv (...,..., color);
glEnd (GL_QUADS);


Alfonse Reinheart
08-03-2015, 04:35 PM
Uniforms (https://www.opengl.org/wiki/Uniform_%28GLSL%29) are so named because they don't change per-vertex (or per-fragment). Every shader invocation for a rendering command will receive the same value for uniforms.

If you want each vertex to have a color, then you need to pass the color as a per-vertex parameter. Since you're using immediate mode and fixed function, you would probably use glColor to pass the value and the built-in gl_Color attribute in the vertex shader to receive it.