- some additional check on OpenGL symbol availability (changes Spat approved)

This commit is contained in:
granzuglia 2012-09-20 07:08:09 +00:00
parent 47adc093b2
commit 2879a62b08
1 changed files with 40 additions and 21 deletions

View File

@ -45,9 +45,13 @@ class Context : public detail::NonCopyable
bool acquire(void) bool acquire(void)
{ {
//
this->release(); this->release();
//
this->initializeTargets(); this->initializeTargets();
//
this->m_acquired = true; this->m_acquired = true;
(void)glGetError();
return this->m_acquired; return this->m_acquired;
} }
@ -57,6 +61,7 @@ class Context : public detail::NonCopyable
this->m_acquired = false; this->m_acquired = false;
this->terminateTargets(); this->terminateTargets();
this->invalidateReferencesToAllObjects(); this->invalidateReferencesToAllObjects();
(void)glGetError();
} }
bool isAcquired(void) const bool isAcquired(void) const
@ -450,16 +455,29 @@ class Context : public detail::NonCopyable
this->initializeTarget<BoundDrawFramebuffer, DrawFramebufferBindingParams >(DrawFramebufferBindingParams () ); this->initializeTarget<BoundDrawFramebuffer, DrawFramebufferBindingParams >(DrawFramebufferBindingParams () );
this->initializeTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () ); this->initializeTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
{
this->m_maxUniformBuffers = 0;
if (GLEW_ARB_uniform_buffer_object)
{ {
GLint uniformBuffers = 0; GLint uniformBuffers = 0;
glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &uniformBuffers); 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); this->m_maxUniformBuffers = int(uniformBuffers);
for (int i=0; i<this->m_maxUniformBuffers; ++i) for (int i=0; i<this->m_maxUniformBuffers; ++i)
{ {
this->initializeTarget<BoundUniformBuffer, UniformBufferBindingParams>(UniformBufferBindingParams(GLuint(i), 0, 0)); this->initializeTarget<BoundUniformBuffer, UniformBufferBindingParams>(UniformBufferBindingParams(GLuint(i), 0, 0));
}
} }
} }
{
this->m_maxFeedbackBuffers = 0;
if (GLEW_EXT_transform_feedback)
{ {
GLint feedbackBuffers = 0; GLint feedbackBuffers = 0;
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &feedbackBuffers); glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, &feedbackBuffers);
@ -469,6 +487,7 @@ class Context : public detail::NonCopyable
this->initializeTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams>(FeedbackBufferBindingParams(GLuint(i), 0, 0)); this->initializeTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams>(FeedbackBufferBindingParams(GLuint(i), 0, 0));
} }
} }
}
{ {
GLint texUnits = 0; GLint texUnits = 0;