Kaydet (Commit) c831e485 authored tarafından Emmanuel Gil Peyrot's avatar Emmanuel Gil Peyrot Kaydeden (comit) Tomaž Vajngerl

slideshow: Fix what was remaining to be able to use a core context

Change-Id: Ifb22c75c77d6bb5d3f144a1ed92bbcdf8d1112fd
üst 859e64aa
...@@ -143,6 +143,9 @@ void OGLTransitionImpl::prepare( sal_Int32 glLeavingSlideTex, sal_Int32 glEnteri ...@@ -143,6 +143,9 @@ void OGLTransitionImpl::prepare( sal_Int32 glLeavingSlideTex, sal_Int32 glEnteri
m_nSceneTransformLocation = glGetUniformLocation( m_nProgramObject, "u_sceneTransformMatrix" ); m_nSceneTransformLocation = glGetUniformLocation( m_nProgramObject, "u_sceneTransformMatrix" );
m_nOperationsTransformLocation = glGetUniformLocation( m_nProgramObject, "u_operationsTransformMatrix" ); m_nOperationsTransformLocation = glGetUniformLocation( m_nProgramObject, "u_operationsTransformMatrix" );
glGenVertexArrays(1, &m_nVertexArrayObject);
glBindVertexArray(m_nVertexArrayObject);
glGenBuffers(1, &m_nVertexBufferObject); glGenBuffers(1, &m_nVertexBufferObject);
glBindBuffer(GL_ARRAY_BUFFER, m_nVertexBufferObject); glBindBuffer(GL_ARRAY_BUFFER, m_nVertexBufferObject);
...@@ -186,6 +189,8 @@ void OGLTransitionImpl::finish() ...@@ -186,6 +189,8 @@ void OGLTransitionImpl::finish()
if( m_nProgramObject ) { if( m_nProgramObject ) {
glDeleteBuffers(1, &m_nVertexBufferObject); glDeleteBuffers(1, &m_nVertexBufferObject);
m_nVertexBufferObject = 0; m_nVertexBufferObject = 0;
glDeleteVertexArrays(1, &m_nVertexArrayObject);
m_nVertexArrayObject = 0;
glDeleteProgram( m_nProgramObject ); glDeleteProgram( m_nProgramObject );
m_nProgramObject = 0; m_nProgramObject = 0;
} }
...@@ -220,7 +225,6 @@ void OGLTransitionImpl::displaySlides_( double nTime, sal_Int32 glLeavingSlideTe ...@@ -220,7 +225,6 @@ void OGLTransitionImpl::displaySlides_( double nTime, sal_Int32 glLeavingSlideTe
} }
} }
glEnable(GL_TEXTURE_2D);
glActiveTexture( GL_TEXTURE2 ); glActiveTexture( GL_TEXTURE2 );
glBindTexture( GL_TEXTURE_2D, glEnteringSlideTex ); glBindTexture( GL_TEXTURE_2D, glEnteringSlideTex );
glActiveTexture( GL_TEXTURE0 ); glActiveTexture( GL_TEXTURE0 );
...@@ -301,9 +305,8 @@ OGLTransitionImpl::displaySlide( ...@@ -301,9 +305,8 @@ OGLTransitionImpl::displaySlide(
void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight ) void OGLTransitionImpl::displayScene( double nTime, double SlideWidth, double SlideHeight, double DispWidth, double DispHeight )
{ {
CHECK_GL_ERROR();
const SceneObjects_t& rSceneObjects(maScene.getSceneObjects()); const SceneObjects_t& rSceneObjects(maScene.getSceneObjects());
glEnable(GL_TEXTURE_2D); CHECK_GL_ERROR();
for(size_t i(0); i != rSceneObjects.size(); ++i) for(size_t i(0); i != rSceneObjects.size(); ++i)
rSceneObjects[i]->display(m_nSceneTransformLocation, m_nPrimitiveTransformLocation, nTime, SlideWidth, SlideHeight, DispWidth, DispHeight); rSceneObjects[i]->display(m_nSceneTransformLocation, m_nPrimitiveTransformLocation, nTime, SlideWidth, SlideHeight, DispWidth, DispHeight);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
...@@ -389,7 +392,7 @@ void Iris::prepare() ...@@ -389,7 +392,7 @@ void Iris::prepare()
glGenTextures(1, &maTexture); glGenTextures(1, &maTexture);
glBindTexture(GL_TEXTURE_2D, maTexture); glBindTexture(GL_TEXTURE_2D, maTexture);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, img); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, img);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); 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_MAG_FILTER,GL_LINEAR);
...@@ -749,8 +752,6 @@ void RochadeTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTe ...@@ -749,8 +752,6 @@ void RochadeTransition::displaySlides_( double nTime, sal_Int32 glLeavingSlideTe
{ {
applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale ); applyOverallOperations( nTime, SlideWidthScale, SlideHeightScale );
glEnable(GL_TEXTURE_2D);
if( nTime > .5) { if( nTime > .5) {
displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale ); displaySlide( nTime, glLeavingSlideTex, getScene().getLeavingSlide(), SlideWidthScale, SlideHeightScale );
displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale ); displaySlide( nTime, glEnteringSlideTex, getScene().getEnteringSlide(), SlideWidthScale, SlideHeightScale );
...@@ -1528,7 +1529,7 @@ void VortexTransition::prepare( double, double, double, double, double ) ...@@ -1528,7 +1529,7 @@ void VortexTransition::prepare( double, double, double, double, double )
glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, nullptr); glVertexAttribPointer(mnTileInfoLocation, 1, GL_FLOAT, GL_FALSE, 0, nullptr);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, m_nVertexBufferObject);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
} }
...@@ -1591,7 +1592,7 @@ void VortexTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32 ...@@ -1591,7 +1592,7 @@ void VortexTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32
glBufferData(GL_ARRAY_BUFFER, mvTileInfo.size()*sizeof(GLfloat), mvTileInfo.data(), GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, mvTileInfo.size()*sizeof(GLfloat), mvTileInfo.data(), GL_STATIC_DRAW);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, m_nVertexBufferObject);
CHECK_GL_ERROR(); CHECK_GL_ERROR();
} }
......
...@@ -228,12 +228,16 @@ private: ...@@ -228,12 +228,16 @@ private:
GLint m_nNormalLocation = -1; GLint m_nNormalLocation = -1;
GLint m_nTexCoordLocation = -1; GLint m_nTexCoordLocation = -1;
GLuint m_nVertexBufferObject = -1; GLuint m_nVertexArrayObject = -1;
protected: protected:
/** GLSL program object /** GLSL program object
*/ */
GLuint m_nProgramObject = 0; GLuint m_nProgramObject = 0;
/** VBO in which to put primitive data
*/
GLuint m_nVertexBufferObject = -1;
}; };
......
...@@ -984,7 +984,7 @@ void OGLTransitionerImpl::impl_createTexture( ...@@ -984,7 +984,7 @@ void OGLTransitionerImpl::impl_createTexture(
maSlideBitmapLayout.ColorSpace->convertToIntegerColorSpace( maSlideBitmapLayout.ColorSpace->convertToIntegerColorSpace(
data, data,
getOGLColorSpace())); getOGLColorSpace()));
buildMipmaps( 4, buildMipmaps( GL_RGBA,
maSlideSize.Width, maSlideSize.Width,
maSlideSize.Height, maSlideSize.Height,
GL_RGBA, GL_RGBA,
......
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