1
0
Fork 0

Graphics: Change Vertex color to 4 components.

This commit is contained in:
Henrik Hautakoski 2016-02-02 00:09:29 +01:00
parent edfc5298e1
commit 8675018522
7 changed files with 12 additions and 12 deletions

View file

@ -130,10 +130,10 @@ void BatchRenderer2D::render()
// Setup color
glEnableVertexAttribArray(VertexAttribColor0);
glVertexAttribPointer(VertexAttribColor0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex2D), (void*) 8);
glVertexAttribPointer(VertexAttribColor0, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex2D), (void*) 8);
glEnableVertexAttribArray(VertexAttribTexCoord0);
glVertexAttribPointer(VertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex2D), (void*) 20);
glVertexAttribPointer(VertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex2D), (void*) 24);
// Set shader uniforms.
m_textShader.enable();

View file

@ -60,7 +60,7 @@ void Sprite::setSize(vec2f size)
void Sprite::setColor(const Color& color)
{
m_vertices[0].color = color.toRGBf();
m_vertices[0].color = color.toRGBAf();
m_vertices[1].color = m_vertices[0].color;
m_vertices[2].color = m_vertices[0].color;
m_vertices[3].color = m_vertices[0].color;

View file

@ -92,7 +92,7 @@ void Text::updateGeometry() const
{
Vector2f origin;
Vector2f size = getSize();
Vector3f color = getColor().toRGBf();
Vector4f color = getColor().toRGBAf();
m_vertices.clear();

View file

@ -22,7 +22,7 @@ uv (_uv)
{
}
Vertex2D::Vertex2D(Vector2f _pos, Vector3f _color, Vector2f _uv) :
Vertex2D::Vertex2D(Vector2f _pos, Vector4f _color, Vector2f _uv) :
position (_pos),
color (_color),
uv (_uv)