Commit 329b86a3 authored by Ken Martin's avatar Ken Martin Committed by Kitware Robot

Merge topic 'fb_fixes'

a7130418 Some fixes for checking framebuffer depths
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Berk Geveci's avatarBerk Geveci <berk.geveci@kitware.com>
Merge-request: !216
parents 4bfac353 a7130418
......@@ -315,40 +315,21 @@ void vtkDepthPeelingPass::Render(const vtkRenderState *s)
return; // nothing to render.
}
// check driver support
vtkOpenGLRenderWindow *renWin
= vtkOpenGLRenderWindow::SafeDownCast(s->GetRenderer()->GetRenderWindow());
// we need alpha planes
GLint alphaBits;
#if GL_ES_VERSION_2_0 != 1 || GL_ES_VERSION_3_0 == 1
if (vtkOpenGLRenderWindow::GetContextSupportsOpenGL32())
{
// wow, this is how you get the alpha depth properly
GLint fboBind = 0;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fboBind);
GLenum attachment = GL_FRONT_LEFT;
if (fboBind != 0)
{
attachment = GL_COLOR_ATTACHMENT0;
}
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER,
attachment,
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &alphaBits);
}
else
#endif
{
glGetIntegerv(GL_ALPHA_BITS, &alphaBits);
}
int rgba[4];
renWin->GetColorBufferSizes(rgba);
if (alphaBits < 8)
if (rgba[3] < 8)
{
// just use alpha blending
this->TranslucentPass->Render(s);
return;
}
// check driver support
vtkOpenGLRenderWindow *renWin
= vtkOpenGLRenderWindow::SafeDownCast(s->GetRenderer()->GetRenderWindow());
// Depth peeling.
vtkRenderer *r=s->GetRenderer();
......
......@@ -479,10 +479,20 @@ int vtkOpenGLRenderWindow::GetColorBufferSizes(int *rgba)
{
GLint fboBind = 0;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fboBind);
GLenum attachment = GL_FRONT_LEFT;
if (fboBind != 0)
GLint attachment = GL_BACK_LEFT;
glGetIntegerv(GL_DRAW_BUFFER, &attachment);
// GL seems odd with its handling of left/right.
// if it says we are using GL_FRONT or GL_BACK
// then convert those to GL_FRONT_LEFT and
// GL_BACK_LEFT.
if (attachment == GL_FRONT)
{
attachment = GL_COLOR_ATTACHMENT0;
attachment = GL_FRONT_LEFT;
}
if (attachment == GL_BACK)
{
attachment = GL_BACK_LEFT;
}
glGetFramebufferAttachmentParameteriv(GL_DRAW_FRAMEBUFFER,
attachment,
......
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