summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-11-16 20:31:58 +0200
committerTor Lillqvist <tml@collabora.com>2015-11-19 12:56:58 +0200
commit149d889adc2997bf303c1e51cb183a5da24feb73 (patch)
treebfab23420b5971cb66259bf5b0868e7351d4581b
parentf013ce8fc6dc07a0e5e659c3361ded83d90b5e88 (diff)
Add OpenGLContext::UseNoProgram()
Will be useful in cases where there is some external library code that uses shaders outside of our OpenGLContext. Change-Id: I59c57e3225f55d13e69b6a9b7c0db1a7487c586d
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx1
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx10
2 files changed, 11 insertions, 0 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 28db7f9ed814..fb09bd586b85 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -167,6 +167,7 @@ public:
// retrieve a program from the cache or compile/link it
OpenGLProgram* GetProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble = "" );
OpenGLProgram* UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble = "" );
+ void UseNoProgram();
/// Is this GL context the current context ?
bool isCurrent();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d7d431372697..1f5af6f00a82 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1732,4 +1732,14 @@ OpenGLProgram* OpenGLContext::UseProgram( const OUString& rVertexShader, const O
return mpCurrentProgram;
}
+void OpenGLContext::UseNoProgram()
+{
+ if( mpCurrentProgram == NULL )
+ return;
+
+ mpCurrentProgram = NULL;
+ glUseProgram( 0 );
+ CHECK_GL_ERROR();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */