[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - 4 commits - vcl/inc vcl/opengl
Louis-Francis Ratté-Boulianne
lfrb at collabora.com
Mon Nov 10 10:47:41 PST 2014
vcl/inc/opengl/salbmp.hxx | 2
vcl/inc/opengl/texture.hxx | 3 +
vcl/inc/openglgdiimpl.hxx | 17 +++++-
vcl/opengl/gdiimpl.cxx | 127 ++++++++++++++++++++++++++++++++-------------
vcl/opengl/salbmp.cxx | 15 +++--
vcl/opengl/texture.cxx | 10 +++
vcl/opengl/x11/gdiimpl.cxx | 7 +-
7 files changed, 137 insertions(+), 44 deletions(-)
New commits:
commit cde6111a538b11e30112a727ea777b36664c4c82
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date: Mon Nov 10 13:46:12 2014 -0500
vcl: Use a different FBO when rendering using a VirtualDevice
Change-Id: I8cb97a4057c06ca09adfcac8dcd3f61ac9508430
diff --git a/vcl/inc/opengl/salbmp.hxx b/vcl/inc/opengl/salbmp.hxx
index 6f7a03a..77ac90b 100644
--- a/vcl/inc/opengl/salbmp.hxx
+++ b/vcl/inc/opengl/salbmp.hxx
@@ -81,7 +81,7 @@ public:
public:
- bool Create( OpenGLContext& rContext, long nX, long nY, long nWidth, long nHeight );
+ bool Create( OpenGLContext& rContext, OpenGLTextureSharedPtr pTex, long nX, long nY, long nWidth, long nHeight );
bool Draw( OpenGLContext& rContext, const SalTwoRect& rPosAry );
GLuint GetTexture( OpenGLContext& rContext ) const;
diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx
index f9d3ad8..c0b6541 100644
--- a/vcl/inc/opengl/texture.hxx
+++ b/vcl/inc/opengl/texture.hxx
@@ -39,6 +39,9 @@ public:
virtual ~OpenGLTexture();
GLuint Id() const;
+ int GetWidth() const;
+ int GetHeight() const;
+
void Bind();
void Unbind();
bool Draw();
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index cd1b7d4..5a11952 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -23,6 +23,8 @@
#include "salgdiimpl.hxx"
#include <vcl/dllapi.h>
+#include "opengl/texture.hxx"
+
#include <vcl/opengl/OpenGLContext.hxx>
class SalFrame;
@@ -36,6 +38,10 @@ protected:
SalFrame* mpFrame;
SalVirtualDevice* mpVDev;
+ bool mbOffscreen;
+ GLuint mnFramebufferId;
+ OpenGLTextureSharedPtr mpOffscreenTex;
+
SalColor mnLineColor;
SalColor mnFillColor;
@@ -90,6 +96,9 @@ protected:
// operations to do after painting
virtual void PostDraw();
+ // enable/disable offscreen rendering
+ virtual void SetOffscreen( bool bOffscreen );
+
public:
virtual ~OpenGLSalGraphicsImpl ();
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index dcc8af4..9a1b1d7 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -58,16 +58,21 @@ OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl()
void OpenGLSalGraphicsImpl::PreDraw()
{
maContext.makeCurrent();
+ // TODO: lfrb: make sure the render target has the right size
+ if( mbOffscreen )
+ glBindFramebuffer( GL_FRAMEBUFFER, mnFramebufferId );
glViewport( 0, 0, GetWidth(), GetHeight() );
}
void OpenGLSalGraphicsImpl::PostDraw()
{
+ if( mbOffscreen )
+ glBindFramebuffer( GL_FRAMEBUFFER, 0 );
}
void OpenGLSalGraphicsImpl::freeResources()
{
- // Delete shaders, programs and textures if not shared
+ // TODO Delete shaders, programs and textures if not shared
}
bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip )
@@ -170,6 +175,38 @@ void OpenGLSalGraphicsImpl::SetROPFillColor( SalROPColor /*nROPColor*/ )
{
}
+// enable/disbale offscreen rendering
+void OpenGLSalGraphicsImpl::SetOffscreen( bool bOffscreen )
+{
+ if( bOffscreen == mbOffscreen )
+ {
+ // Already disabled
+ if( !mbOffscreen )
+ return;
+
+ // Already enabled and same size
+ if( mpOffscreenTex->GetWidth() == GetWidth() &&
+ mpOffscreenTex->GetHeight() == GetHeight() )
+ return;
+ }
+ else
+ {
+ mbOffscreen = bOffscreen;
+ if( bOffscreen )
+ glGenFramebuffers( 1, &mnFramebufferId );
+ else
+ glDeleteFramebuffers( 1, &mnFramebufferId );
+ }
+
+ if( mbOffscreen )
+ {
+ glBindFramebuffer( GL_FRAMEBUFFER, mnFramebufferId );
+ mpOffscreenTex.reset( new OpenGLTexture( GetWidth(), GetHeight() ) );
+ glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mpOffscreenTex->Id(), 0 );
+ CHECK_GL_ERROR();
+ }
+}
+
bool OpenGLSalGraphicsImpl::CreateSolidProgram( void )
{
mnSolidProgram = OpenGLHelper::LoadShaders( "solidVertexShader", "solidFragmentShader" );
@@ -861,7 +898,7 @@ SalBitmap* OpenGLSalGraphicsImpl::getBitmap( long nX, long nY, long nWidth, long
SAL_INFO( "vcl.opengl", "::getBitmap " << nX << "," << nY <<
" " << nWidth << "x" << nHeight );
PreDraw();
- if( !pBitmap->Create( maContext, nX, nY, nWidth, nHeight ) )
+ if( !pBitmap->Create( maContext, mpOffscreenTex, nX, nY, nWidth, nHeight ) )
{
delete pBitmap;
pBitmap = NULL;
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 564426c..97dca8b 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -52,7 +52,7 @@ OpenGLSalBitmap::~OpenGLSalBitmap()
SAL_INFO( "vcl.opengl", "~OpenGLSalBitmap" );
}
-bool OpenGLSalBitmap::Create( OpenGLContext& rContext, long nX, long nY, long nWidth, long nHeight )
+bool OpenGLSalBitmap::Create( OpenGLContext& rContext, OpenGLTextureSharedPtr pTex, long nX, long nY, long nWidth, long nHeight )
{
static const BitmapPalette aEmptyPalette;
@@ -60,7 +60,6 @@ bool OpenGLSalBitmap::Create( OpenGLContext& rContext, long nX, long nY, long nW
SAL_INFO( "vcl.opengl", "OpenGLSalBitmap::Create from FBO" );
mpContext = &rContext;
- mpContext->makeCurrent();
mnWidth = nWidth;
mnHeight = nHeight;
mnBufWidth = 0;
@@ -70,8 +69,13 @@ bool OpenGLSalBitmap::Create( OpenGLContext& rContext, long nX, long nY, long nW
mnBits = 32;
maPalette = aEmptyPalette;
- mpTexture.reset( new OpenGLTexture( nX, nY, nWidth, nHeight ) );
+ // TODO: lfrb: Crop texture if size doesn't match the texture one
+ if( pTex )
+ mpTexture = pTex;
+ else
+ mpTexture.reset( new OpenGLTexture( nX, nY, nWidth, nHeight ) );
mbDirtyTexture = false;
+ SAL_INFO( "vcl.opengl", "Created texture " << mpTexture->Id() );
return true;
}
@@ -154,6 +158,7 @@ GLuint OpenGLSalBitmap::GetTexture( OpenGLContext& rContext ) const
const_cast<OpenGLSalBitmap*>(this)->mpContext = &rContext;
if( !mpTexture || mbDirtyTexture )
const_cast<OpenGLSalBitmap*>(this)->CreateTexture();
+ SAL_INFO( "vcl.opengl", "Got texture " << mpTexture->Id() );
return mpTexture->Id();
}
@@ -383,9 +388,9 @@ GLuint OpenGLSalBitmap::CreateTexture()
}
}
- SAL_INFO( "vcl.opengl", "::CreateTexture" );
mpContext->makeCurrent();
mpTexture.reset( new OpenGLTexture (mnBufWidth, mnBufHeight, nFormat, nType, pData ) );
+ SAL_INFO( "vcl.opengl", "Created texture " << mpTexture->Id() );
if( bAllocated )
delete pData;
@@ -407,6 +412,8 @@ bool OpenGLSalBitmap::ReadTexture()
GLuint nFramebufferId, nRenderbufferDepthId, nRenderbufferColorId;
sal_uInt8* pData = maUserBuffer.get();
+ SAL_INFO( "vcl.opengl", "::ReadTexture" );
+
// TODO Check mnTexWidth and mnTexHeight
mpContext->makeCurrent();
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 2770c20..0c8dc1d 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -95,6 +95,16 @@ GLuint OpenGLTexture::Id() const
return mnTexture;
}
+int OpenGLTexture::GetWidth() const
+{
+ return mnWidth;
+}
+
+int OpenGLTexture::GetHeight() const
+{
+ return mnHeight;
+}
+
GLenum OpenGLTexture::GetFilter() const
{
return mnFilter;
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 353ec76..6e803bd 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -64,12 +64,14 @@ void X11OpenGLSalGraphicsImpl::Init()
{
Window aWin = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame)->GetX11Window();
maContext.init( mrParent.GetXDisplay(), aWin, mrParent.m_nXScreen.getXScreen());
+ SetOffscreen( false );
}
else if( mrParent.m_pVDev )
{
maContext.init( mrParent.GetXDisplay(), mrParent.m_pVDev->GetDrawable(),
mrParent.m_pVDev->GetWidth(), mrParent.m_pVDev->GetHeight(),
mrParent.m_nXScreen.getXScreen() );
+ SetOffscreen( true );
}
else
{
commit 5bb610be2f67e1752789c0f1b1a0ec6741751907
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date: Mon Nov 10 13:29:52 2014 -0500
vcl: Remove unused shaders list
Change-Id: I13a25a39cceb184c2bb2b48bc143a951ee982b26
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index a1764f1..cd1b7d4 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -39,8 +39,6 @@ protected:
SalColor mnLineColor;
SalColor mnFillColor;
- std::vector< GLuint > maShaders;
-
GLuint mnSolidProgram;
GLuint mnColorUniform;
commit 5a8e5e0e9e642c47cd988aa7d10fb8c717b7c7a7
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date: Mon Nov 10 13:06:38 2014 -0500
vcl: Add methods to call before and after OpenGL rendering
Change-Id: I937907a3e8eb8f841a2eed6199e86d022be7dc16
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index 34c2607..a1764f1 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -86,6 +86,12 @@ protected:
// get the height of the device
virtual GLfloat GetHeight() const = 0;
+ // operations to do before painting
+ virtual void PreDraw();
+
+ // operations to do after painting
+ virtual void PostDraw();
+
public:
virtual ~OpenGLSalGraphicsImpl ();
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index dcee9e8..dcc8af4 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -55,6 +55,16 @@ OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl()
{
}
+void OpenGLSalGraphicsImpl::PreDraw()
+{
+ maContext.makeCurrent();
+ glViewport( 0, 0, GetWidth(), GetHeight() );
+}
+
+void OpenGLSalGraphicsImpl::PostDraw()
+{
+}
+
void OpenGLSalGraphicsImpl::freeResources()
{
// Delete shaders, programs and textures if not shared
@@ -489,11 +499,11 @@ void OpenGLSalGraphicsImpl::drawPixel( long nX, long nY )
SAL_INFO( "vcl.opengl", "::drawPixel" );
if( mnLineColor != SALCOLOR_NONE )
{
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
BeginSolid( mnLineColor );
DrawPoint( nX, nY );
EndSolid();
+ PostDraw();
}
}
@@ -502,11 +512,11 @@ void OpenGLSalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor )
SAL_INFO( "vcl.opengl", "::drawPixel" );
if( nSalColor != SALCOLOR_NONE )
{
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
BeginSolid( nSalColor );
DrawPoint( nX, nY );
EndSolid();
+ PostDraw();
}
}
@@ -515,19 +525,18 @@ void OpenGLSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 )
SAL_INFO( "vcl.opengl", "::drawLine" );
if( mnLineColor != SALCOLOR_NONE )
{
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
BeginSolid( mnLineColor );
DrawLine( nX1, nY1, nX2, nY2 );
EndSolid();
+ PostDraw();
}
}
void OpenGLSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight )
{
SAL_INFO( "vcl.opengl", "::drawRect" );
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
if( mnFillColor != SALCOLOR_NONE )
{
@@ -549,19 +558,21 @@ void OpenGLSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeigh
DrawLines( 4, aPoints, true );
EndSolid();
}
+
+ PostDraw();
}
void OpenGLSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry )
{
SAL_INFO( "vcl.opengl", "::drawPolyLine" );
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
if( mnLineColor != SALCOLOR_NONE && nPoints > 1 )
{
+ PreDraw();
BeginSolid( mnLineColor );
DrawLines( nPoints, pPtAry, false );
EndSolid();
+ PostDraw();
}
}
@@ -582,8 +593,7 @@ void OpenGLSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPt
return;
}
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
if( mnFillColor != SALCOLOR_NONE )
{
@@ -598,6 +608,8 @@ void OpenGLSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPt
DrawLines( nPoints, pPtAry, true );
EndSolid();
}
+
+ PostDraw();
}
void OpenGLSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry )
@@ -606,8 +618,7 @@ void OpenGLSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32*
if( nPoly <= 0 )
return;
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
if( mnFillColor != SALCOLOR_NONE )
{
@@ -625,6 +636,8 @@ void OpenGLSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32*
DrawLines( pPoints[i], pPtAry[i], true );
EndSolid();
}
+
+ PostDraw();
}
bool OpenGLSalGraphicsImpl::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency )
@@ -633,8 +646,7 @@ bool OpenGLSalGraphicsImpl::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rP
if( rPolyPolygon.count() <= 0 )
return true;
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
if( mnFillColor != SALCOLOR_NONE )
{
@@ -647,6 +659,8 @@ bool OpenGLSalGraphicsImpl::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rP
EndSolid();
}
+ PostDraw();
+
return true;
}
@@ -718,8 +732,7 @@ bool OpenGLSalGraphicsImpl::drawPolyLine(
aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getY() / rLineWidth.getX()));
}
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
BeginSolid( mnLineColor, fTransparency );
for( sal_uInt32 i = 0; i < aAreaPolyPoly.count(); i++ )
{
@@ -727,6 +740,7 @@ bool OpenGLSalGraphicsImpl::drawPolyLine(
DrawPolyPolygon( aOnePoly );
}
EndSolid();
+ PostDraw();
return true;
}
@@ -798,9 +812,9 @@ void OpenGLSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry, const SalBitm
const Size aSize = rSalBitmap.GetSize();
SAL_INFO( "vcl.opengl", "::drawBitmap" );
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
DrawTexture( nTexture, aSize, rPosAry );
+ PostDraw();
}
void OpenGLSalGraphicsImpl::drawBitmap(
@@ -822,9 +836,9 @@ void OpenGLSalGraphicsImpl::drawBitmap(
const GLuint nMask( rMask.GetTexture( maContext ) );
SAL_INFO( "vcl.opengl", "::drawBitmap with MASK" );
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
DrawTextureWithMask( nTexture, nMask, rBitmap.GetSize(), rPosAry );
+ PostDraw();
}
void OpenGLSalGraphicsImpl::drawMask(
@@ -836,9 +850,9 @@ void OpenGLSalGraphicsImpl::drawMask(
const GLuint nTexture( rBitmap.GetTexture( maContext ) );
SAL_INFO( "vcl.opengl", "::drawMask" );
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
DrawMask( nTexture, nMaskColor, rPosAry );
+ PostDraw();
}
SalBitmap* OpenGLSalGraphicsImpl::getBitmap( long nX, long nY, long nWidth, long nHeight )
@@ -846,11 +860,13 @@ SalBitmap* OpenGLSalGraphicsImpl::getBitmap( long nX, long nY, long nWidth, long
OpenGLSalBitmap* pBitmap = new OpenGLSalBitmap;
SAL_INFO( "vcl.opengl", "::getBitmap " << nX << "," << nY <<
" " << nWidth << "x" << nHeight );
+ PreDraw();
if( !pBitmap->Create( maContext, nX, nY, nWidth, nHeight ) )
{
delete pBitmap;
pBitmap = NULL;
}
+ PostDraw();
return pBitmap;
}
@@ -858,9 +874,9 @@ SalColor OpenGLSalGraphicsImpl::getPixel( long nX, long nY )
{
char pixel[3];
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
glReadPixels( nX, nY, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel);
+ PostDraw();
return MAKE_SALCOLOR( pixel[0], pixel[1], pixel[2] );
}
@@ -874,8 +890,7 @@ void OpenGLSalGraphicsImpl::invert(
// * SAL_INVERT_50 (50/50 pattern?)
// * SAL_INVERT_TRACKFRAME (dash-line rectangle?)
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
if( nFlags & SAL_INVERT_TRACKFRAME )
{
@@ -891,12 +906,13 @@ void OpenGLSalGraphicsImpl::invert(
DrawRect( nX, nY, nWidth, nHeight );
EndInvert();
}
+
+ PostDraw();
}
void OpenGLSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags )
{
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
if( nFlags & SAL_INVERT_TRACKFRAME )
{
@@ -912,6 +928,8 @@ void OpenGLSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
DrawPolygon( nPoints, pPtAry );
EndInvert();
}
+
+ PostDraw();
}
bool OpenGLSalGraphicsImpl::drawEPS(
@@ -946,9 +964,9 @@ bool OpenGLSalGraphicsImpl::drawAlphaBitmap(
const GLuint nAlpha( rAlpha.GetTexture( maContext ) );
SAL_INFO( "vcl.opengl", "::drawAlphaBitmap" );
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
DrawTextureWithMask( nTexture, nAlpha, rBitmap.GetSize(), rPosAry );
+ PostDraw();
return true;
}
@@ -977,9 +995,11 @@ bool OpenGLSalGraphicsImpl::drawAlphaRect(
SAL_INFO( "vcl.opengl", "::drawAlphaRect" );
if( mnFillColor != SALCOLOR_NONE && nTransparency < 100 )
{
+ PreDraw();
BeginSolid( mnFillColor, nTransparency );
DrawRect( nX, nY, nWidth, nHeight );
EndSolid();
+ PostDraw();
}
return true;
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 11735edb..353ec76 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -114,8 +114,7 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmapToScreen( X11Pixmap* pPixmap, int nX,
pGlxPixmap = glXCreatePixmap( pDisplay, pFbConfig, pPixmap->GetPixmap(), aAttribs);
XSync( pDisplay, 0 );
- maContext.makeCurrent();
- glViewport( 0, 0, GetWidth(), GetHeight() );
+ PreDraw();
glGenTextures( 1, &nTexture );
glActiveTexture( GL_TEXTURE0 );
@@ -133,6 +132,8 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmapToScreen( X11Pixmap* pPixmap, int nX,
glDeleteTextures( 1, &nTexture );
glXDestroyPixmap( pDisplay, pGlxPixmap );
+ PostDraw();
+
return true;
}
commit aa40d569de20cec64b534fa513b811891d81ccc8
Author: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Date: Mon Nov 10 10:12:20 2014 -0500
vcl: Fix pixel drawing with OpenGL
Change-Id: I5d8e80baec9537e0c5913d821e26566409fe5261
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 7094727..dcee9e8 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -278,7 +278,7 @@ void OpenGLSalGraphicsImpl::DrawPoint( long nX, long nY )
pPoint[1] = 2 * (GetHeight() - nY) / GetHeight() - 1.0f;
glEnableVertexAttribArray( GL_ATTRIB_POS );
- glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_UNSIGNED_SHORT, GL_FALSE, 0, pPoint );
+ glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, pPoint );
glDrawArrays( GL_POINTS, 0, 1 );
glDisableVertexAttribArray( GL_ATTRIB_POS );
}
More information about the Libreoffice-commits
mailing list