Commit f161cf55 authored by Ken Martin's avatar Ken Martin

fix srystal eves buffers and add errro checking

Some extra error checking in the framebuffer class
parent b75bc715
......@@ -686,6 +686,11 @@ void vtkOpenGLFramebufferObject::SaveCurrentBindingsAndBuffers()
void vtkOpenGLFramebufferObject::SaveCurrentBindingsAndBuffers(unsigned int mode)
{
if (!this->Context)
{
vtkErrorMacro("Attempt to save bindings without a context");
return;
}
if (mode == GL_FRAMEBUFFER || mode == GL_DRAW_FRAMEBUFFER)
{
this->Context->GetState()->PushDrawFramebufferBinding();
......@@ -705,6 +710,11 @@ void vtkOpenGLFramebufferObject::RestorePreviousBindingsAndBuffers()
void vtkOpenGLFramebufferObject::RestorePreviousBindingsAndBuffers(unsigned int mode)
{
if (!this->Context)
{
vtkErrorMacro("Attempt to restore bindings without a context");
return;
}
if ((mode == GL_FRAMEBUFFER || mode == GL_DRAW_FRAMEBUFFER) && this->DrawBindingSaved)
{
this->Context->GetState()->PopDrawFramebufferBinding();
......
......@@ -984,7 +984,7 @@ void vtkOpenGLRenderWindow::StereoMidpoint()
this->GetState()->PushFramebufferBindings();
this->OffScreenFramebuffer->Bind(GL_READ_FRAMEBUFFER);
this->GetState()->vtkglBindFramebuffer(GL_DRAW_FRAMEBUFFER, this->DefaultFrameBufferId);
this->GetState()->vtkglDrawBuffer(this->BackRightBuffer);
this->GetState()->vtkglDrawBuffer(this->GetBackLeftBuffer());
int* fbsize = this->OffScreenFramebuffer->GetLastSize();
// recall Blit upper right corner is exclusive of the range
......@@ -1004,7 +1004,14 @@ void vtkOpenGLRenderWindow::Frame()
this->GetState()->PushFramebufferBindings();
this->OffScreenFramebuffer->Bind(GL_READ_FRAMEBUFFER);
this->GetState()->vtkglBindFramebuffer(GL_DRAW_FRAMEBUFFER, this->DefaultFrameBufferId);
this->GetState()->vtkglDrawBuffer(this->BackLeftBuffer);
if (this->StereoRender && this->StereoType == VTK_STEREO_CRYSTAL_EYES)
{
this->GetState()->vtkglDrawBuffer(this->GetBackRightBuffer());
}
else
{
this->GetState()->vtkglDrawBuffer(this->GetBackLeftBuffer());
}
int* fbsize = this->OffScreenFramebuffer->GetLastSize();
// recall Blit upper right corner is exclusive of the range
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment