Wednesday, 14 August 2013

Vertex shader matrix multiplication not doing anything

Vertex shader matrix multiplication not doing anything

I've been struggling with an issue with my vertex shader. I have a sprite
with the following position attributes:
sprite->vertices[0][0] = -1.0f;
sprite->vertices[0][1] = +1.0f;
sprite->vertices[1][0] = -1.0f;
sprite->vertices[1][1] = -1.0f;
sprite->vertices[2][0] = +1.0f;
sprite->vertices[2][1] = +1.0f;
sprite->vertices[3][0] = +1.0f;
sprite->vertices[3][1] = -1.0f;
And I use the attribute this way:
glUseProgram(sprite->program);
glEnableVertexAttribArray(sprite->position_attrib);
glVertexAttribPointer(sprite->position_attrib, 2, GL_FLOAT, GL_FALSE, 0,
sprite->vertices);
Here is my vertex shader:
static const char character_vshader_g[] =
"#ifdef GL_ES\n"
"precision mediump float;\n"
"

No comments:

Post a Comment