[DEV] correction of error of openGl error when lose context

This commit is contained in:
Edouard DUPIN 2013-08-27 23:52:39 +02:00
parent 371a3cb599
commit 8668ac9dd0
7 changed files with 17 additions and 1 deletions

View File

@ -124,7 +124,7 @@ public abstract class EwolWallpaper extends WallpaperService implements EwolCall
// On Honeycomb+ devices, this improves the performance when // On Honeycomb+ devices, this improves the performance when
// leaving and resuming the live wallpaper. // leaving and resuming the live wallpaper.
setPreserveEGLContextOnPause(true); //setPreserveEGLContextOnPause(true);
} }

View File

@ -11,6 +11,7 @@
#include <ewol/renderer/ResourceManager.h> #include <ewol/renderer/ResourceManager.h>
#include <ewol/renderer/resources/FontFreeType.h> #include <ewol/renderer/resources/FontFreeType.h>
#include <ewol/ewol.h> #include <ewol/ewol.h>
#include <ewol/renderer/openGL.h>
// Specific for the resource : // Specific for the resource :
@ -113,6 +114,7 @@ void ewol::resource::UpdateContext(void)
for (int32_t iii=0; iii<l_resourceList.Size(); iii++) { for (int32_t iii=0; iii<l_resourceList.Size(); iii++) {
if(l_resourceList[iii] != NULL) { if(l_resourceList[iii] != NULL) {
if (jjj==l_resourceList[iii]->GetResourceLevel()) { if (jjj==l_resourceList[iii]->GetResourceLevel()) {
//EWOL_DEBUG("Update context of " << iii << " named : " << l_resourceList[iii]->GetName());
l_resourceList[iii]->UpdateContext(); l_resourceList[iii]->UpdateContext();
} }
} }
@ -145,6 +147,7 @@ void ewol::resource::ContextHasBeenDestroyed(void)
l_resourceList[iii]->RemoveContextToLate(); l_resourceList[iii]->RemoveContextToLate();
} }
} }
ewol::openGL::ContextIsRemoved();
// no context preent ... // no context preent ...
l_contextHasBeenRemoved = true; l_contextHasBeenRemoved = true;
} }

View File

@ -37,6 +37,12 @@ void ewol::openGL::UnInit(void)
l_matrixCamera.Identity(); l_matrixCamera.Identity();
} }
void ewol::openGL::ContextIsRemoved(void)
{
// same as call Init, but in case of changing...
ewol::openGL::Init();
}
void ewol::openGL::SetBasicMatrix(const mat4& newOne) void ewol::openGL::SetBasicMatrix(const mat4& newOne)
{ {
if (l_matrixList.Size()!=1) { if (l_matrixList.Size()!=1) {

View File

@ -64,6 +64,10 @@ namespace ewol {
* @brief un-init the opengl element from the graphic card * @brief un-init the opengl element from the graphic card
*/ */
void UnInit(void); void UnInit(void);
/**
* @brief Need to call it when openGl context is removed ==> need to reset internal properties ...
*/
void ContextIsRemoved(void);
/** /**
* @brief When you will done an opengl rendering, you might call this reset matrix first. It remove all the stach of the matrix pushed. * @brief When you will done an opengl rendering, you might call this reset matrix first. It remove all the stach of the matrix pushed.
* @param[in] newOne the default matrix that might be set for the graphic card for renderer. if too more pop will be done, this is the last that mmight survived * @param[in] newOne the default matrix that might be set for the graphic card for renderer. if too more pop will be done, this is the last that mmight survived

View File

@ -776,6 +776,7 @@ void ewol::Program::SetTexture1(int32_t idElem, GLint textureOpenGlID)
void ewol::Program::UnUse(void) void ewol::Program::UnUse(void)
{ {
//EWOL_WARNING("Will use program : " << m_program);
if (0==m_program) { if (0==m_program) {
return; return;
} }

View File

@ -77,6 +77,7 @@ void ewol::Shader::UpdateContext(void)
checkGlError("glCreateShader"); checkGlError("glCreateShader");
return; return;
} else { } else {
//EWOL_INFO("Creater shader with GLID=" << m_shader);
glShaderSource(m_shader, 1, (const char**)&m_fileData, NULL); glShaderSource(m_shader, 1, (const char**)&m_fileData, NULL);
glCompileShader(m_shader); glCompileShader(m_shader);
GLint compiled = 0; GLint compiled = 0;

View File

@ -97,6 +97,7 @@ void ewol::Texture::RemoveContext(void)
void ewol::Texture::RemoveContextToLate(void) void ewol::Texture::RemoveContextToLate(void)
{ {
m_loaded = false; m_loaded = false;
m_texId=0;
} }