Can't pass color to shader


I don’t know if this belongs here or in the GLSL category, but here goes:

This is the shader program I’m using:

#version 330 core

uniform mat4 modelViewProjection;

layout(location = 0) in vec3 modelSpaceVertexPosition;
layout(location = 1) in vec4 vertexColor;
layout(location = 2) in vec2 vertexTextureCoordinates;

out vec4 color;
out vec2 textureCoordinates;

void main() {
	gl_Position = modelViewProjection * vec4(modelSpaceVertexPosition, 1);
	color = vertexColor;
	textureCoordinates = vertexTextureCoordinates;

#version 330 core

uniform sampler2D diffuseTexture;
in vec4 color;
in vec2 textureCoordinates;
out vec4 fragmentColor;

void main() {
	fragmentColor = texture2D(diffuseTexture, textureCoordinates) * color;

I’m trying to edit the librocket sample to use this shader:

Everything is working fine except for vertexColor/color which is always (1,1,1,1).

I’m running out of ideas. What am I doing wrong?

What does your glVertexAttribPointer call look like for vertexColor? If you are passing in unsigned bytes are you setting the normalized argument to GL_TRUE to get [0.0 to 1.0] rather than [0.0 to 255.0]?

That was it. I misunderstood the function of that parameters. Thank you very much.