- some additional check on OpenGL symbol availability (changes Spat approved)
This commit is contained in:
parent
47adc093b2
commit
2879a62b08
|
@ -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<BoundVertexBuffer, VertexBufferBindingParams >(VertexBufferBindingParams () );
|
||||
this->initializeTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
||||
this->initializeTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
||||
this->initializeTarget<BoundPixelUnpackBuffer, PixelUnpackBufferBindingParams >(PixelUnpackBufferBindingParams () );
|
||||
this->initializeTarget<BoundRenderbuffer, RenderbufferBindingParams >(RenderbufferBindingParams () );
|
||||
this->initializeTarget<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
||||
this->initializeTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
||||
this->initializeTarget<BoundFragmentShader, FragmentShaderBindingParams >(FragmentShaderBindingParams () );
|
||||
this->initializeTarget<BoundProgram, ProgramBindingParams >(ProgramBindingParams () );
|
||||
this->initializeTarget<BoundReadFramebuffer, ReadFramebufferBindingParams >(ReadFramebufferBindingParams () );
|
||||
this->initializeTarget<BoundDrawFramebuffer, DrawFramebufferBindingParams >(DrawFramebufferBindingParams () );
|
||||
this->initializeTarget<BoundIndexBuffer, IndexBufferBindingParams >(IndexBufferBindingParams () );
|
||||
this->initializeTarget<BoundPixelPackBuffer, PixelPackBufferBindingParams >(PixelPackBufferBindingParams () );
|
||||
this->initializeTarget<BoundPixelUnpackBuffer, PixelUnpackBufferBindingParams >(PixelUnpackBufferBindingParams () );
|
||||
this->initializeTarget<BoundRenderbuffer, RenderbufferBindingParams >(RenderbufferBindingParams () );
|
||||
this->initializeTarget<BoundVertexShader, VertexShaderBindingParams >(VertexShaderBindingParams () );
|
||||
this->initializeTarget<BoundGeometryShader, GeometryShaderBindingParams >(GeometryShaderBindingParams () );
|
||||
this->initializeTarget<BoundFragmentShader, FragmentShaderBindingParams >(FragmentShaderBindingParams () );
|
||||
this->initializeTarget<BoundProgram, ProgramBindingParams >(ProgramBindingParams () );
|
||||
this->initializeTarget<BoundReadFramebuffer, ReadFramebufferBindingParams >(ReadFramebufferBindingParams () );
|
||||
this->initializeTarget<BoundDrawFramebuffer, DrawFramebufferBindingParams >(DrawFramebufferBindingParams () );
|
||||
this->initializeTarget<BoundReadDrawFramebuffer, ReadDrawFramebufferBindingParams >(ReadDrawFramebufferBindingParams () );
|
||||
|
||||
{
|
||||
GLint uniformBuffers = 0;
|
||||
glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &uniformBuffers);
|
||||
this->m_maxUniformBuffers = int(uniformBuffers);
|
||||
for (int i=0; i<this->m_maxUniformBuffers; ++i)
|
||||
this->m_maxUniformBuffers = 0;
|
||||
if (GLEW_ARB_uniform_buffer_object)
|
||||
{
|
||||
this->initializeTarget<BoundUniformBuffer, UniformBufferBindingParams>(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; i<this->m_maxUniformBuffers; ++i)
|
||||
{
|
||||
|
||||
this->initializeTarget<BoundUniformBuffer, UniformBufferBindingParams>(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; i<this->m_maxFeedbackBuffers; ++i)
|
||||
this->m_maxFeedbackBuffers = 0;
|
||||
if (GLEW_EXT_transform_feedback)
|
||||
{
|
||||
this->initializeTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams>(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; i<this->m_maxFeedbackBuffers; ++i)
|
||||
{
|
||||
this->initializeTarget<BoundFeedbackBuffer, FeedbackBufferBindingParams>(FeedbackBufferBindingParams(GLuint(i), 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue