Merge pull request #5850 from jherico/dargo

Remove overcalling of glVertexAttrib4f
This commit is contained in:
Philip Rosedale 2015-09-18 16:38:22 -07:00
commit 5e64420ea1
2 changed files with 10 additions and 3 deletions

View file

@ -603,11 +603,16 @@ void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
DO_IT_NOW(_glColor4f, 4); DO_IT_NOW(_glColor4f, 4);
} }
void GLBackend::do_glColor4f(Batch& batch, uint32 paramOffset) { void GLBackend::do_glColor4f(Batch& batch, uint32 paramOffset) {
// TODO Replace this with a proper sticky Input attribute buffer with frequency 0
glVertexAttrib4f( gpu::Stream::COLOR, glm::vec4 newColor(
batch._params[paramOffset + 3]._float, batch._params[paramOffset + 3]._float,
batch._params[paramOffset + 2]._float, batch._params[paramOffset + 2]._float,
batch._params[paramOffset + 1]._float, batch._params[paramOffset + 1]._float,
batch._params[paramOffset + 0]._float); batch._params[paramOffset + 0]._float);
if (_input._colorAttribute != newColor) {
_input._colorAttribute = newColor;
glVertexAttrib4fv(gpu::Stream::COLOR, &_input._colorAttribute.r);
}
(void) CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }

View file

@ -278,6 +278,8 @@ protected:
Offsets _bufferStrides; Offsets _bufferStrides;
std::vector<GLuint> _bufferVBOs; std::vector<GLuint> _bufferVBOs;
glm::vec4 _colorAttribute{ 0.0f };
BufferPointer _indexBuffer; BufferPointer _indexBuffer;
Offset _indexBufferOffset; Offset _indexBufferOffset;
Type _indexBufferType; Type _indexBufferType;