From 2879a62b0874588386fcf909884bde66d2b4b5cf Mon Sep 17 00:00:00 2001 From: granzuglia Date: Thu, 20 Sep 2012 07:08:09 +0000 Subject: [PATCH] - some additional check on OpenGL symbol availability (changes Spat approved) --- wrap/glw/context.h | 61 ++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/wrap/glw/context.h b/wrap/glw/context.h index 5fc55d45..b1044ebb 100644 --- a/wrap/glw/context.h +++ b/wrap/glw/context.h @@ -45,9 +45,13 @@ class Context : public detail::NonCopyable bool acquire(void) { + // this->release(); + // this->initializeTargets(); + // this->m_acquired = true; + (void)glGetError(); return this->m_acquired; } @@ -57,6 +61,7 @@ class Context : public detail::NonCopyable this->m_acquired = false; this->terminateTargets(); this->invalidateReferencesToAllObjects(); + (void)glGetError(); } bool isAcquired(void) const @@ -436,37 +441,51 @@ class Context : public detail::NonCopyable } void initializeTargets(void) - { + { this->initializeTarget(VertexBufferBindingParams () ); - this->initializeTarget(IndexBufferBindingParams () ); - this->initializeTarget(PixelPackBufferBindingParams () ); - this->initializeTarget(PixelUnpackBufferBindingParams () ); - this->initializeTarget(RenderbufferBindingParams () ); - this->initializeTarget(VertexShaderBindingParams () ); - this->initializeTarget(GeometryShaderBindingParams () ); - this->initializeTarget(FragmentShaderBindingParams () ); - this->initializeTarget(ProgramBindingParams () ); - this->initializeTarget(ReadFramebufferBindingParams () ); - this->initializeTarget(DrawFramebufferBindingParams () ); + this->initializeTarget(IndexBufferBindingParams () ); + this->initializeTarget(PixelPackBufferBindingParams () ); + this->initializeTarget(PixelUnpackBufferBindingParams () ); + this->initializeTarget(RenderbufferBindingParams () ); + this->initializeTarget(VertexShaderBindingParams () ); + this->initializeTarget(GeometryShaderBindingParams () ); + this->initializeTarget(FragmentShaderBindingParams () ); + this->initializeTarget(ProgramBindingParams () ); + this->initializeTarget(ReadFramebufferBindingParams () ); + this->initializeTarget(DrawFramebufferBindingParams () ); this->initializeTarget(ReadDrawFramebufferBindingParams () ); { - GLint uniformBuffers = 0; - glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &uniformBuffers); - this->m_maxUniformBuffers = int(uniformBuffers); - for (int i=0; im_maxUniformBuffers; ++i) + this->m_maxUniformBuffers = 0; + if (GLEW_ARB_uniform_buffer_object) { - this->initializeTarget(UniformBufferBindingParams(GLuint(i), 0, 0)); + GLint uniformBuffers = 0; + + glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &uniformBuffers); + GLenum err = glGetError(); + const GLubyte* errr = gluErrorString(err); + assert(err == GL_NO_ERROR); + this->m_maxUniformBuffers = int(uniformBuffers); + for (int i=0; im_maxUniformBuffers; ++i) + { + + this->initializeTarget(UniformBufferBindingParams(GLuint(i), 0, 0)); + + } } } { - GLint feedbackBuffers = 0; - glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &feedbackBuffers); - this->m_maxFeedbackBuffers = int(feedbackBuffers); - for (int i=0; im_maxFeedbackBuffers; ++i) + this->m_maxFeedbackBuffers = 0; + if (GLEW_EXT_transform_feedback) { - this->initializeTarget(FeedbackBufferBindingParams(GLuint(i), 0, 0)); + GLint feedbackBuffers = 0; + glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &feedbackBuffers); + this->m_maxFeedbackBuffers = int(feedbackBuffers); + for (int i=0; im_maxFeedbackBuffers; ++i) + { + this->initializeTarget(FeedbackBufferBindingParams(GLuint(i), 0, 0)); + } } }