[Libreoffice-commits] core.git: Branch 'feature/mac-opengl-fixes' - 5 commits - chart2/source include/vcl slideshow/source vcl/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Aug 26 10:09:53 PDT 2014
chart2/source/view/main/GL3DRenderer.cxx | 20 ----
chart2/source/view/main/OpenGLRender.cxx | 25 -----
include/vcl/opengl/OpenGLHelper.hxx | 4
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx | 42 ++++++++++
slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx | 26 ++++++
vcl/source/opengl/OpenGLHelper.cxx | 22 +++++
6 files changed, 94 insertions(+), 45 deletions(-)
New commits:
commit 48230b8bcfae5d37d3fc1edc09fc5c889a53e55a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 26 19:09:04 2014 +0200
add invalid framebuffer operation to OpenGL error messages
Change-Id: I359ec166e9bf0585842fb436a1edd20720b89a9b
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 3802212..4c10f26 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -231,6 +231,7 @@ const char* OpenGLHelper::GLErrorString(GLenum errorCode)
{GL_STACK_OVERFLOW, "stack overflow"},
{GL_STACK_UNDERFLOW, "stack underflow"},
{GL_OUT_OF_MEMORY, "out of memory"},
+ {GL_INVALID_FRAMEBUFFER_OPERATION, "invalid framebuffer operation"},
{0, NULL }
};
commit e3d378bbbda57c721eec78a553e68ba13e9dabed
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 26 18:02:58 2014 +0200
check framebuffer status
Change-Id: Ieb36804247b4e2790d625585661a1c85586348f1
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index d3c39c1..3802212 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -319,7 +319,11 @@ void OpenGLHelper::createFramebuffer(long nWidth, long nHeight, GLuint& nFramebu
// attach a renderbuffer to depth attachment point
glBindRenderbuffer(GL_RENDERBUFFER, nRenderbufferDepthId);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, nRenderbufferDepthId);
- glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE)
+ {
+ SAL_WARN("vcl.opengl", "invalid framebuffer status");
+ }
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
@@ -350,6 +354,8 @@ void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
SAL_WARN("vcl.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << pFile << " at line: " << nLine);
else
SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available) in File " << pFile << " at line: " << nLine);
+
+ glErr = glGetError();
}
}
commit 5e8d485eef4dfe7832c8a7a4a29cd10eca5fa7d5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 26 18:02:38 2014 +0200
simplify code
Change-Id: If0b1c47a1e0f6084795fb5ca4a2acced736d4523
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index d513907..d829177 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -67,7 +67,7 @@ static GLfloat coordReverseVertices[] = {
};
#define CHECK_GL_FRAME_BUFFER_STATUS() \
- status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\
+ GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\
if( status != GL_FRAMEBUFFER_COMPLETE ) {\
SAL_WARN("chart2.opengl", "OpenGL error: " << status );\
return -1;\
@@ -243,7 +243,6 @@ int OpenGLRender::RenderLine2FBO(int)
CHECK_GL_ERROR();
m_Line2DShapePointList.pop_front();
}
- GLenum status;
CHECK_GL_ERROR();
CHECK_GL_FRAME_BUFFER_STATUS();
m_fZStep += Z_STEP;
commit 6824cc4b906370357351c77f86ec092a6bf885ae
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Aug 26 14:44:12 2014 +0200
add OpenGL error checking to OGLTrans
Change-Id: I9e511221e3da54b44935ebde22c49e5a151f6961
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index 222590c..6af1027 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -99,6 +99,7 @@ void OGLTransitionImpl::finish()
static void blendSlide( double depth )
{
+ CHECK_GL_ERROR();
double showHeight = -1 + depth*2;
GLfloat reflectionColor[] = {0, 0, 0, 0.25};
@@ -121,10 +122,12 @@ static void blendSlide( double depth )
glVertex3f( 1, showHeight, 0 );
glEnd();
glEnable( GL_DEPTH_TEST );
+ CHECK_GL_ERROR();
}
static void slideShadow( double nTime, const Primitive& primitive, double sw, double sh )
{
+ CHECK_GL_ERROR();
double reflectionDepth = 0.3;
glEnable(GL_BLEND);
@@ -138,6 +141,7 @@ static void slideShadow( double nTime, const Primitive& primitive, double sw, do
glDisable(GL_BLEND);
glEnable(GL_LIGHTING);
+ CHECK_GL_ERROR();
}
void OGLTransitionImpl::prepare_( double, double, double, double, double )
@@ -154,6 +158,7 @@ void OGLTransitionImpl::finishTransition_()
void OGLTransitionImpl::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
{
+ CHECK_GL_ERROR();
applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
glEnable(GL_TEXTURE_2D);
@@ -173,6 +178,7 @@ void OGLTransitionImpl::display( double nTime, ::sal_Int32 glLeavingSlideTex, ::
displaySlides_( nTime, glLeavingSlideTex, glEnteringSlideTex, SlideWidthScale, SlideHeightScale );
displayScene( nTime, SlideWidth, SlideHeight, DispWidth, DispHeight );
glPopMatrix();
+ CHECK_GL_ERROR();
}
void OGLTransitionImpl::applyOverallOperations( double nTime, double SlideWidthScale, double SlideHeightScale )
@@ -188,6 +194,7 @@ OGLTransitionImpl::displaySlide(
const ::sal_Int32 glSlideTex, const Primitives_t& primitives,
double SlideWidthScale, double SlideHeightScale )
{
+ CHECK_GL_ERROR();
//TODO change to foreach
glBindTexture(GL_TEXTURE_2D, glSlideTex);
@@ -215,18 +222,22 @@ OGLTransitionImpl::displaySlide(
for(unsigned int i(0); i < primitives.size(); ++i)
primitives[i].display(nTime, SlideWidthScale, SlideHeightScale);
+ CHECK_GL_ERROR();
}
void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
{
+ CHECK_GL_ERROR();
const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
glEnable(GL_TEXTURE_2D);
for(unsigned int i(0); i != rSceneObjects.size(); ++i)
rSceneObjects[i]->display(nTime, SlideWidth, SlideHeight, DispWidth, DispHeight);
+ CHECK_GL_ERROR();
}
void Primitive::display(double nTime, double WidthScale, double HeightScale) const
{
+ CHECK_GL_ERROR();
glPushMatrix();
applyOperations( nTime, WidthScale, HeightScale );
@@ -242,17 +253,21 @@ void Primitive::display(double nTime, double WidthScale, double HeightScale) con
glVertexPointer( 3, GL_DOUBLE, 0, &Vertices[0] );
glDrawArrays( GL_TRIANGLES, 0, Vertices.size() );
glPopMatrix();
+ CHECK_GL_ERROR();
}
void Primitive::applyOperations(double nTime, double WidthScale, double HeightScale) const
{
+ CHECK_GL_ERROR();
for(unsigned int i(0); i < Operations.size(); ++i)
Operations[i]->interpolate( nTime ,WidthScale,HeightScale);
glScaled(WidthScale,HeightScale,1);
+ CHECK_GL_ERROR();
}
void SceneObject::display(double nTime, double /* SlideWidth */, double /* SlideHeight */, double DispWidth, double DispHeight ) const
{
+ CHECK_GL_ERROR();
for(unsigned int i(0); i < maPrimitives.size(); ++i) {
// fixme: allow various model spaces, now we make it so that
// it is regular -1,-1 to 1,1, where the whole display fits in
@@ -264,6 +279,7 @@ void SceneObject::display(double nTime, double /* SlideWidth */, double /* Slide
maPrimitives[i].display(nTime, 1, 1);
glPopMatrix();
}
+ CHECK_GL_ERROR();
}
void SceneObject::pushPrimitive(const Primitive &p)
@@ -294,6 +310,7 @@ void Iris::display(double nTime, double SlideWidth, double SlideHeight, double D
void Iris::prepare()
{
+ CHECK_GL_ERROR();
static const GLubyte img[3] = { 80, 80, 80 };
glGenTextures(1, &maTexture);
@@ -303,11 +320,14 @@ void Iris::prepare()
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
+ CHECK_GL_ERROR();
}
void Iris::finish()
{
+ CHECK_GL_ERROR();
glDeleteTextures(1, &maTexture);
+ CHECK_GL_ERROR();
}
namespace
@@ -911,16 +931,19 @@ inline double intervalInter(double t, double T0, double T1)
void STranslate::interpolate(double t,double SlideWidthScale,double SlideHeightScale) const
{
+ CHECK_GL_ERROR();
if(t <= nT0)
return;
if(!bInterpolate || t > nT1)
t = nT1;
t = intervalInter(t,nT0,nT1);
glTranslated(SlideWidthScale*t*vector.getX(),SlideHeightScale*t*vector.getY(),t*vector.getZ());
+ CHECK_GL_ERROR();
}
void SRotate::interpolate(double t,double SlideWidthScale,double SlideHeightScale) const
{
+ CHECK_GL_ERROR();
if(t <= nT0)
return;
if(!bInterpolate || t > nT1)
@@ -931,10 +954,12 @@ void SRotate::interpolate(double t,double SlideWidthScale,double SlideHeightScal
glRotated(t*angle,axis.getX(),axis.getY(),axis.getZ());
glScaled(1/SlideWidthScale,1/SlideHeightScale,1);
glTranslated(-SlideWidthScale*origin.getX(),-SlideHeightScale*origin.getY(),-origin.getZ());
+ CHECK_GL_ERROR();
}
void SScale::interpolate(double t,double SlideWidthScale,double SlideHeightScale) const
{
+ CHECK_GL_ERROR();
if(t <= nT0)
return;
if(!bInterpolate || t > nT1)
@@ -943,10 +968,12 @@ void SScale::interpolate(double t,double SlideWidthScale,double SlideHeightScale
glTranslated(SlideWidthScale*origin.getX(),SlideHeightScale*origin.getY(),origin.getZ());
glScaled((1-t) + t*scale.getX(),(1-t) + t*scale.getY(),(1-t) + t*scale.getZ());
glTranslated(-SlideWidthScale*origin.getX(),-SlideHeightScale*origin.getY(),-origin.getZ());
+ CHECK_GL_ERROR();
}
void RotateAndScaleDepthByWidth::interpolate(double t,double SlideWidthScale,double SlideHeightScale) const
{
+ CHECK_GL_ERROR();
if(t <= nT0)
return;
if(!bInterpolate || t > nT1)
@@ -955,10 +982,12 @@ void RotateAndScaleDepthByWidth::interpolate(double t,double SlideWidthScale,dou
glTranslated(SlideWidthScale*origin.getX(),SlideHeightScale*origin.getY(),SlideWidthScale*origin.getZ());
glRotated(t*angle,axis.getX(),axis.getY(),axis.getZ());
glTranslated(-SlideWidthScale*origin.getX(),-SlideHeightScale*origin.getY(),-SlideWidthScale*origin.getZ());
+ CHECK_GL_ERROR();
}
void RotateAndScaleDepthByHeight::interpolate(double t,double SlideWidthScale,double SlideHeightScale) const
{
+ CHECK_GL_ERROR();
if(t <= nT0)
return;
if(!bInterpolate || t > nT1)
@@ -967,6 +996,7 @@ void RotateAndScaleDepthByHeight::interpolate(double t,double SlideWidthScale,do
glTranslated(SlideWidthScale*origin.getX(),SlideHeightScale*origin.getY(),SlideHeightScale*origin.getZ());
glRotated(t*angle,axis.getX(),axis.getY(),axis.getZ());
glTranslated(-SlideWidthScale*origin.getX(),-SlideHeightScale*origin.getY(),-SlideHeightScale*origin.getZ());
+ CHECK_GL_ERROR();
}
SEllipseTranslate::SEllipseTranslate(double dWidth, double dHeight, double dStartPosition, double dEndPosition, bool bInter, double T0, double T1)
@@ -1184,6 +1214,7 @@ private:
void FadeSmoothlyTransition::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
{
+ CHECK_GL_ERROR();
applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
glDisable(GL_DEPTH_TEST);
@@ -1201,6 +1232,7 @@ void FadeSmoothlyTransition::displaySlides_( double nTime, ::sal_Int32 glLeaving
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
+ CHECK_GL_ERROR();
}
shared_ptr<OGLTransitionImpl>
@@ -1250,6 +1282,7 @@ private:
void FadeThroughBlackTransition::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex, double SlideWidthScale, double SlideHeightScale )
{
+ CHECK_GL_ERROR();
applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
glDisable(GL_DEPTH_TEST);
@@ -1270,6 +1303,7 @@ void FadeThroughBlackTransition::displaySlides_( double nTime, ::sal_Int32 glLea
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
+ CHECK_GL_ERROR();
}
shared_ptr<OGLTransitionImpl>
@@ -1335,6 +1369,7 @@ private:
void ShaderTransition::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideTex, ::sal_Int32 glEnteringSlideTex,
double SlideWidthScale, double SlideHeightScale )
{
+ CHECK_GL_ERROR();
applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
if( m_nProgramObject ) {
@@ -1349,6 +1384,7 @@ void ShaderTransition::displaySlides_( double nTime, ::sal_Int32 glLeavingSlideT
glActiveTexture( GL_TEXTURE0 );
displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
+ CHECK_GL_ERROR();
}
void ShaderTransition::prepareTransition_( ::sal_Int32 /* glLeavingSlideTex */, ::sal_Int32 /* glEnteringSlideTex */ )
@@ -1360,6 +1396,7 @@ void ShaderTransition::prepareTransition_( ::sal_Int32 /* glLeavingSlideTex */,
void ShaderTransition::finishTransition_()
{
+ CHECK_GL_ERROR();
if( m_nProgramObject ) {
glDeleteProgram( m_nProgramObject );
m_nProgramObject = 0;
@@ -1369,6 +1406,7 @@ void ShaderTransition::finishTransition_()
glDeleteTextures( 1, &m_nHelperTexture );
m_nHelperTexture = 0;
}
+ CHECK_GL_ERROR();
}
int permutation256 [256]= {
@@ -1408,6 +1446,7 @@ int permutation256 [256]= {
void initPermTexture(GLuint *texID)
{
+ CHECK_GL_ERROR();
glGenTextures(1, texID);
glBindTexture(GL_TEXTURE_2D, *texID);
@@ -1426,10 +1465,12 @@ void initPermTexture(GLuint *texID)
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, permutation2D );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+ CHECK_GL_ERROR();
}
void ShaderTransition::impl_preparePermShader()
{
+ CHECK_GL_ERROR();
if( m_nProgramObject ) {
glUseProgram( m_nProgramObject );
@@ -1453,6 +1494,7 @@ void ShaderTransition::impl_preparePermShader()
glUniform1i( location, 2 ); // texture unit 2
}
}
+ CHECK_GL_ERROR();
}
}
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index 5879330..00c84ca 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -328,10 +328,12 @@ bool OGLTransitionerImpl::initialize( const Reference< presentation::XSlideShowV
setSlides( xLeavingSlide, xEnteringSlide );
return mbGLXPresent;
+ CHECK_GL_ERROR();
}
void OGLTransitionerImpl::impl_initializeFlags( bool const bGLXPresent )
{
+ CHECK_GL_ERROR();
mbGLXPresent = bGLXPresent;
if ( bGLXPresent ) {
mnGLVersion = OpenGLHelper::getGLVersion();
@@ -344,6 +346,7 @@ void OGLTransitionerImpl::impl_initializeFlags( bool const bGLXPresent )
/* TODO: check for version once the bug in fglrx driver is fixed */
mbBrokenTexturesATI = (vendor && strcmp( (const char *) vendor, "ATI Technologies Inc." ) == 0 );
}
+ CHECK_GL_ERROR();
}
bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presentation::XSlideShowView >& xView )
@@ -372,12 +375,14 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta
sal_Int64 aVal = 0;
aDeviceParams[1] >>= aVal;
+ SAL_WARN("slideshow", "created the context");
mpContext = boost::make_shared<OpenGLContext>();
mpContext->requestLegacyContext();
if( !mpContext->init( reinterpret_cast< Window* >( aVal ) ) )
return false;
+ CHECK_GL_ERROR();
awt::Rectangle aCanvasArea = mxView->getCanvasArea();
mpContext->setWinPosAndSize(Point(aCanvasArea.X, aCanvasArea.Y), Size(aCanvasArea.Width, aCanvasArea.Height));
SAL_INFO("slideshow.opengl", "canvas area: " << aCanvasArea.X << "," << aCanvasArea.Y << " - " << aCanvasArea.Width << "x" << aCanvasArea.Height);
@@ -389,10 +394,12 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta
#endif
mbGenerateMipmap = rGLWindow.HasGLExtension( "GL_SGIS_generate_mipmap" );
+ CHECK_GL_ERROR();
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glClearColor (0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
+ CHECK_GL_ERROR();
mpContext->swapBuffers();
@@ -405,6 +412,7 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta
glEnable(GL_NORMALIZE);
glViewport(0, 0, aCanvasArea.Width, aCanvasArea.Height);
+ CHECK_GL_ERROR();
return true;
}
@@ -438,7 +446,9 @@ void OGLTransitionerImpl::impl_prepareSlides()
aSlideRect.Y1 = 0;
aSlideRect.Y2 = maSlideSize.Height;
+ CHECK_GL_ERROR();
mpContext->sync();
+ CHECK_GL_ERROR();
mbUseLeavingPixmap = false;
mbUseEnteringPixmap = false;
@@ -522,12 +532,14 @@ void OGLTransitionerImpl::impl_prepareSlides()
if( !mbUseEnteringPixmap )
maEnteringBytes = mxEnteringBitmap->getData(maSlideBitmapLayout, aSlideRect);
+ CHECK_GL_ERROR();
GLInitSlides();
SAL_WARN_IF(maSlideBitmapLayout.PlaneStride != 0, "slideshow.opengl","only handle no plane stride now");
mpContext->sync();
+ CHECK_GL_ERROR();
#if defined( UNX ) && !defined( MACOSX )
// synchronized X still gives us much smoother play
// I suspect some issues in above code in slideshow
@@ -569,11 +581,13 @@ void OGLTransitionerImpl::createTexture( GLuint* texID,
uno::Sequence<sal_Int8>& data,
const OGLFormat* pFormat )
{
+ CHECK_GL_ERROR();
glDeleteTextures( 1, texID );
glGenTextures( 1, texID );
glBindTexture( GL_TEXTURE_2D, *texID );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
+ CHECK_GL_ERROR();
#if defined( GLX_EXT_texture_from_pixmap )
PFNGLXBINDTEXIMAGEEXTPROC myglXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC) glXGetProcAddress( (const GLubyte*) "glXBindTexImageEXT" );
@@ -597,6 +611,7 @@ void OGLTransitionerImpl::createTexture( GLuint* texID,
impl_createTexture( useMipmap, data, pFormat );
#endif
SAL_WARN_IF(!glIsTexture(*texID), "slideshow.opengl", "Can't generate Leaving slide textures in OpenGL");
+ CHECK_GL_ERROR();
}
namespace
@@ -960,6 +975,7 @@ void OGLTransitionerImpl::impl_createTexture(
{
if( !pFormat )
{
+ CHECK_GL_ERROR();
// force-convert color to ARGB8888 int color space
uno::Sequence<sal_Int8> tempBytes(
maSlideBitmapLayout.ColorSpace->convertToIntegerColorSpace(
@@ -995,10 +1011,12 @@ void OGLTransitionerImpl::impl_createTexture(
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_supported_anisotropy );
}
}
+ CHECK_GL_ERROR();
}
void OGLTransitionerImpl::prepareEnvironment()
{
+ CHECK_GL_ERROR();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
double EyePos(10.0);
@@ -1022,6 +1040,7 @@ void OGLTransitionerImpl::prepareEnvironment()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslated(0,0,-EyePos);
+ CHECK_GL_ERROR();
}
const OGLFormat* OGLTransitionerImpl::chooseFormats()
@@ -1163,6 +1182,7 @@ void OGLTransitionerImpl::GLInitSlides()
if( !mbUseLeavingPixmap || !mbUseEnteringPixmap )
pFormat = chooseFormats();
+ CHECK_GL_ERROR();
createTexture( &maLeavingSlideGL,
#if defined( GLX_EXT_texture_from_pixmap )
maLeavingPixmapGL,
@@ -1181,7 +1201,9 @@ void OGLTransitionerImpl::GLInitSlides()
maEnteringBytes,
pFormat );
+ CHECK_GL_ERROR();
mpContext->sync();
+ CHECK_GL_ERROR();
}
void SAL_CALL OGLTransitionerImpl::update( double nTime ) throw (uno::RuntimeException, std::exception)
@@ -1199,6 +1221,7 @@ void SAL_CALL OGLTransitionerImpl::update( double nTime ) throw (uno::RuntimeExc
if (isDisposed() || !mbGLXPresent || mpTransition->getSettings().mnRequiredGLVersion > mnGLVersion)
return;
+ CHECK_GL_ERROR();
mpContext->makeCurrent();
glEnable(GL_DEPTH_TEST);
@@ -1217,6 +1240,7 @@ void SAL_CALL OGLTransitionerImpl::update( double nTime ) throw (uno::RuntimeExc
mpContext->show();
mpContext->sync();
+ CHECK_GL_ERROR();
#if OSL_DEBUG_LEVEL > 1
maUpdateEndTime = microsec_clock::local_time();
@@ -1244,6 +1268,7 @@ void SAL_CALL OGLTransitionerImpl::viewChanged( const Reference< presentation::X
void OGLTransitionerImpl::disposeTextures()
{
+ CHECK_GL_ERROR();
mpContext->makeCurrent();
#if defined( GLX_EXT_texture_from_pixmap )
@@ -1283,6 +1308,7 @@ void OGLTransitionerImpl::disposeTextures()
mbUseLeavingPixmap = false;
mbUseEnteringPixmap = false;
+ CHECK_GL_ERROR();
}
void OGLTransitionerImpl::impl_dispose()
commit 3f6a9617fb9a023d74841d675de3c77d10cd3018
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Aug 18 15:38:04 2014 +0200
extract some shared code
Change-Id: I062ea860f695189ab1d59615f1d2390710a21d44
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 4c11cd8..d87ede4 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -34,26 +34,6 @@ namespace {
const int CORNER_DIVION_Y = 20;
const int CORNER_DIVION_Z = 20;
-int static checkGLError(const char *file, int line)
-{
- GLenum glErr;
- int retCode = 0;
- glErr = glGetError();
- while (glErr != GL_NO_ERROR)
- {
- const char* sError = OpenGLHelper::GLErrorString(glErr);
- if (sError)
- SAL_WARN("chart2.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << file << " at line: " << line);
- else
- SAL_WARN("chart2.opengl", "GL Error #" << glErr << " (no message available) in File " << file << " at line: " << line);
- retCode = -1;
- return retCode;
- }
- return retCode;
-}
-
-#define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__)
-
GLfloat texCoords[] = {
1.0f, 0.0f,
1.0f, 1.0f,
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 2c93d36..d513907 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -66,28 +66,6 @@ static GLfloat coordReverseVertices[] = {
0.0f, 0.0f,
};
-int static checkGLError(const char *file, int line)
-{
- GLenum glErr;
- int retCode = 0;
- glErr = glGetError();
- while (glErr != GL_NO_ERROR)
- {
- const char* sError = OpenGLHelper::GLErrorString(glErr);
-
- if (sError)
- SAL_WARN("chart2.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << file << " at line: " << line);
- else
- SAL_WARN("chart2.opengl", "GL Error #" << glErr << " (no message available) in File " << file << " at line: " << line);
-
- retCode = -1;
- return retCode;
- }
- return retCode;
-}
-
-#define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__)
-
#define CHECK_GL_FRAME_BUFFER_STATUS() \
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\
if( status != GL_FRAMEBUFFER_COMPLETE ) {\
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index 52093c2..1358fef 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -38,8 +38,12 @@ public:
// Get OpenGL version (needs a context)
static float getGLVersion();
+
+ static void checkGLError(const char* aFile, size_t nLine);
};
+#define CHECK_GL_ERROR() OpenGLHelper::checkGLError(__FILE__, __LINE__)
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index ab10a25..d3c39c1 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -339,5 +339,18 @@ float OpenGLHelper::getGLVersion()
return fVersion;
}
+void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
+{
+ GLenum glErr = glGetError();
+ while (glErr != GL_NO_ERROR)
+ {
+ const char* sError = OpenGLHelper::GLErrorString(glErr);
+
+ if (sError)
+ SAL_WARN("vcl.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << pFile << " at line: " << nLine);
+ else
+ SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available) in File " << pFile << " at line: " << nLine);
+ }
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list