Hi,
Im using GrContext to enable gpu accelerated rendering in Skia.
GrContext::resetContext function is resetting opengl state to prevent any problems if the client application has changed any opengl state. This works great. Is there a way to restore applications opengl state or roll back when skia has finished its work? Something like GrContext::rollback?.
My process :
Create OpenGL Context
Create GrContext
Create FBO
WrapFbo for Skia
Grab the Context and do some drawing
Now use this FBO somewhere else in my application.
The last step didn't worked for me because of the problem above. And i spent some time today to analyse state changes between the client application and skia library. List of states is not to long and i guess it can vary according to work skia handling at that moment for me.
Now if I roll back this state changes with :
glDisable( GL_BLEND );
glDisable( GL_VERTEX_PROGRAM_POINT_SIZE );
glDisable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
glDisable( GL_VERTEX_PROGRAM_POINT_SIZE_NV );
glDisable( GL_VERTEX_ATTRIB_ARRAY0_NV );
glDisable( GL_VERTEX_ATTRIB_ARRAY1_NV );
glBindVertexArray( 0 );
glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 );
glBindFramebuffer( GL_READ_FRAMEBUFFER_EXT, 0 );
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
glBindFramebuffer( GL_DRAW_FRAMEBUFFER_EXT, 0 );
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glBindFramebuffer( GL_FRAMEBUFFER_EXT, 0 );
glUseProgram( 0 );
glUseProgramObjectARB( 0 );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
glBindBuffer( GL_ARRAY_BUFFER, 0 );
glBindBuffer( GL_ARRAY_BUFFER_ARB, 0 );
glDrawBuffer( GL_BACK );
glEnable( GL_DOUBLEBUFFER );
glEnable( GL_DITHER );
glEnable( GL_DEPTH_WRITEMASK );
every thing works fine.