[Libreoffice-commits] core.git: Branch 'private/mmeeks/opengl-backbuffer2' - vcl/opengl
Michael Meeks
michael.meeks at collabora.com
Sat Dec 5 15:09:43 PST 2015
vcl/opengl/gdiimpl.cxx | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 63291125f74d3a4a7c0e91e2a1d9ca3293e5bc73
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat Dec 5 22:11:24 2015 +0000
We need a stencil buffer attached to the framebuffer to clip.
Change-Id: I257346a198c4db9eb05c8c49c059c4b3aa96e197
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 3266dea..311a121 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -277,6 +277,18 @@ void OpenGLSalGraphicsImpl::freeResources()
void OpenGLSalGraphicsImpl::ImplSetClipBit( const vcl::Region& rClip, GLuint nMask )
{
glEnable( GL_STENCIL_TEST );
+
+ GLuint nStencil = 0;
+ glGenRenderbuffers(1, &nStencil);
+ glBindRenderbuffer(GL_RENDERBUFFER, nStencil);
+ CHECK_GL_ERROR();
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX,
+ GetWidth(), GetHeight());
+ CHECK_GL_ERROR();
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER, nStencil);
+ CHECK_GL_ERROR();
+
CHECK_GL_ERROR();
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
CHECK_GL_ERROR();
@@ -311,7 +323,7 @@ void OpenGLSalGraphicsImpl::ImplInitClipRegion()
if( maClipRegion != mpContext->maClipRegion )
{
mpContext->maClipRegion = maClipRegion;
- if( maClipRegion.IsRectangle() )
+ if( mbUseScissor )
{
Rectangle aRect( maClipRegion.GetBoundRect() );
glScissor( aRect.Left(), GetHeight() - aRect.Bottom() - 1, aRect.GetWidth() + 1, aRect.GetHeight() + 1 );
More information about the Libreoffice-commits
mailing list