[Scummvm-git-logs] scummvm master -> 0eb11216fb48fb45118882e0c3d8006265996c2b
bluegr
noreply at scummvm.org
Sun Jul 3 19:26:13 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0eb11216fb OPENGL: Add Shader::addAttribute()
Commit: 0eb11216fb48fb45118882e0c3d8006265996c2b
https://github.com/scummvm/scummvm/commit/0eb11216fb48fb45118882e0c3d8006265996c2b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-07-03T22:26:10+03:00
Commit Message:
OPENGL: Add Shader::addAttribute()
Changed paths:
graphics/opengl/shader.cpp
graphics/opengl/shader.h
diff --git a/graphics/opengl/shader.cpp b/graphics/opengl/shader.cpp
index 57bbb78fac9..78155245ff8 100644
--- a/graphics/opengl/shader.cpp
+++ b/graphics/opengl/shader.cpp
@@ -331,6 +331,22 @@ void Shader::freeBuffer(GLuint vbo) {
GL_CALL(glDeleteBuffers(1, &vbo));
}
+bool Shader::addAttribute(const char *attrib) {
+ uint32 i;
+ for (i = 0; i < _attributes.size(); ++i)
+ if (_attributes[i]._name.equals(attrib))
+ return true;
+
+ GLint result = -1;
+ GL_ASSIGN(result, glGetAttribLocation(*_shaderNo, attrib));
+ if (result == -1)
+ return false;
+
+ GL_CALL(glBindAttribLocation(*_shaderNo, i, attrib));
+ _attributes.push_back(VertexAttrib(i, attrib));
+ return true;
+}
+
VertexAttrib &Shader::getAttributeAt(uint32 idx) {
assert(idx < _attributes.size());
return _attributes[idx];
diff --git a/graphics/opengl/shader.h b/graphics/opengl/shader.h
index c580c95c997..b1925bd0da8 100644
--- a/graphics/opengl/shader.h
+++ b/graphics/opengl/shader.h
@@ -161,6 +161,7 @@ public:
void disableVertexAttribute(const char *attrib, const Math::Matrix<r,1> &m) {
disableVertexAttribute(attrib, r, m.getData());
}
+ bool addAttribute(const char *attrib);
VertexAttrib & getAttributeAt(uint32 idx);
VertexAttrib & getAttribute(const char *attrib);
More information about the Scummvm-git-logs
mailing list