diff --git a/apps/projectGenerator b/apps/projectGenerator index d1e3854eaf5..28d3e248a94 160000 --- a/apps/projectGenerator +++ b/apps/projectGenerator @@ -1 +1 @@ -Subproject commit d1e3854eaf51ca9da7f6c788d6931f69b0579ba5 +Subproject commit 28d3e248a94c8f7da91385b78abdb3c1f5238411 diff --git a/libs/openFrameworks/gl/ofShader.cpp b/libs/openFrameworks/gl/ofShader.cpp index b4df3358905..4603662217b 100644 --- a/libs/openFrameworks/gl/ofShader.cpp +++ b/libs/openFrameworks/gl/ofShader.cpp @@ -1018,6 +1018,15 @@ void ofShader::setUniform4i(const string & name, int v1, int v2, int v3, int v4) } } +//-------------------------------------------------------------- +void ofShader::setUniformBufferObject(const std::string & name, const void * data, GLsizeiptr dataSize) { + if (!bufferObjectsCache[name].isAllocated()) { + bufferObjectsCache[name].allocate(dataSize, GL_STATIC_DRAW); + } + bufferObjectsCache[name].updateData(dataSize, data); + bufferObjectsCache[name].bindBase(GL_UNIFORM_BUFFER, getUniformBlockIndex(name)); +} + //-------------------------------------------------------------- void ofShader::setUniform1f(const string & name, float v1) const { if (bLoaded) { diff --git a/libs/openFrameworks/gl/ofShader.h b/libs/openFrameworks/gl/ofShader.h index c1d4eb39000..d0cfcecaafb 100644 --- a/libs/openFrameworks/gl/ofShader.h +++ b/libs/openFrameworks/gl/ofShader.h @@ -159,6 +159,10 @@ class ofShader { void setUniform3i(const std::string & name, int v1, int v2, int v3) const; void setUniform4i(const std::string & name, int v1, int v2, int v3, int v4) const; + + // Dmtr testing + void setUniformBufferObject(const std::string & name, const void * data, GLsizeiptr dataSize); + void setUniform1f(const std::string & name, float v1) const; void setUniform2f(const std::string & name, float v1, float v2) const; void setUniform3f(const std::string & name, float v1, float v2, float v3) const; @@ -278,6 +282,8 @@ class ofShader { }; std::unordered_map shaders; + + std::unordered_map bufferObjectsCache; std::unordered_map uniformsCache; mutable std::unordered_map attributesBindingsCache; diff --git a/scripts/apothecary b/scripts/apothecary index 80811668fed..7d5a6d85683 160000 --- a/scripts/apothecary +++ b/scripts/apothecary @@ -1 +1 @@ -Subproject commit 80811668fed996a4f450e7d3ce97502380b39c16 +Subproject commit 7d5a6d856838d02224464d57ef19bd17609d4e50