Android texture reloading after suspending
This commit is contained in:
parent
a4c8558ab7
commit
67ebc4b017
@ -40,6 +40,7 @@ void EWOL_ThreadResize(int w, int h );
|
|||||||
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y);
|
void EWOL_ThreadEventInputMotion(int pointerID, float x, float y);
|
||||||
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y);
|
void EWOL_ThreadEventInputState(int pointerID, bool isUp, float x, float y);
|
||||||
void EWOL_NativeRender(void);
|
void EWOL_NativeRender(void);
|
||||||
|
void EWOL_NativeGLDestroy(void);
|
||||||
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
@ -74,6 +75,9 @@ extern "C"
|
|||||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnPause( JNIEnv* env )
|
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnPause( JNIEnv* env )
|
||||||
{
|
{
|
||||||
EDN_DEBUG("Activity On Pause");
|
EDN_DEBUG("Activity On Pause");
|
||||||
|
// All the openGl has been destroyed ...
|
||||||
|
// TODO : Mark all the texture to be reloaded ...
|
||||||
|
EWOL_NativeGLDestroy();
|
||||||
}
|
}
|
||||||
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStop( JNIEnv* env )
|
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityOnStop( JNIEnv* env )
|
||||||
{
|
{
|
||||||
|
@ -358,6 +358,18 @@ void ewol::texture::UnInit(void)
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol"
|
#define __class__ "ewol"
|
||||||
|
|
||||||
|
void ewol::UpdateTextureContextIsDestroy(void)
|
||||||
|
{
|
||||||
|
pthread_mutex_lock(&localMutex);
|
||||||
|
for (int32_t iii=0; iii < listLoadedTexture.Size(); iii++) {
|
||||||
|
if( NULL != listLoadedTexture[iii]
|
||||||
|
&& NULL != listLoadedTexture[iii]->m_data)
|
||||||
|
{
|
||||||
|
listLoadedTexture[iii]->m_loaded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&localMutex);
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::UpdateTextureContext(void)
|
void ewol::UpdateTextureContext(void)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@ namespace ewol
|
|||||||
int32_t GetTextureSize(uint32_t textureID);
|
int32_t GetTextureSize(uint32_t textureID);
|
||||||
uint32_t GetTextureGLID(uint32_t textureID);
|
uint32_t GetTextureGLID(uint32_t textureID);
|
||||||
void UpdateTextureContext(void);
|
void UpdateTextureContext(void);
|
||||||
|
void UpdateTextureContextIsDestroy(void);
|
||||||
void TextureOGLContext(bool enable);
|
void TextureOGLContext(bool enable);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ static pthread_t androidJniThread;
|
|||||||
//static pthread_attr_t androidJniThreadAttr;
|
//static pthread_attr_t androidJniThreadAttr;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
THREAD_INIT,
|
||||||
THREAD_UN_INIT,
|
THREAD_UN_INIT,
|
||||||
THREAD_RESIZE,
|
THREAD_RESIZE,
|
||||||
THREAD_HIDE,
|
THREAD_HIDE,
|
||||||
@ -110,6 +111,9 @@ static void* BaseAppEntry(void* param)
|
|||||||
countNbEvent++;
|
countNbEvent++;
|
||||||
//EWOL_DEBUG("EVENT");
|
//EWOL_DEBUG("EVENT");
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
|
case THREAD_INIT:
|
||||||
|
EWOL_DEBUG("Receive MSG : THREAD_INIT");
|
||||||
|
break;
|
||||||
case THREAD_UN_INIT:
|
case THREAD_UN_INIT:
|
||||||
EWOL_DEBUG("Receive MSG : THREAD_UN_INIT");
|
EWOL_DEBUG("Receive MSG : THREAD_UN_INIT");
|
||||||
requestEndProcessing = true;
|
requestEndProcessing = true;
|
||||||
@ -226,6 +230,7 @@ void EWOL_SystemStart(void)
|
|||||||
// init the thread :
|
// init the thread :
|
||||||
pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
||||||
isGlobalSystemInit = true;
|
isGlobalSystemInit = true;
|
||||||
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ static int64_t nbDisplayTime = 0;
|
|||||||
#define DISPLAY_PERIODE_MS (1000)
|
#define DISPLAY_PERIODE_MS (1000)
|
||||||
|
|
||||||
|
|
||||||
void EWOL_GenericDraw(void)
|
void EWOL_GenericDraw(bool everyTime)
|
||||||
{
|
{
|
||||||
bool display = false;
|
bool display = false;
|
||||||
nbCallTime++;
|
nbCallTime++;
|
||||||
@ -267,7 +267,9 @@ void EWOL_GenericDraw(void)
|
|||||||
display = true;
|
display = true;
|
||||||
}
|
}
|
||||||
ewol::widgetManager::GetDoubleBufferStartDraw();
|
ewol::widgetManager::GetDoubleBufferStartDraw();
|
||||||
if (true == ewol::widgetManager::GetDoubleBufferNeedDraw()) {
|
if( true == ewol::widgetManager::GetDoubleBufferNeedDraw()
|
||||||
|
|| true == everyTime)
|
||||||
|
{
|
||||||
nbDisplayTime++;
|
nbDisplayTime++;
|
||||||
gui_uniqueWindows->SysDraw();
|
gui_uniqueWindows->SysDraw();
|
||||||
}
|
}
|
||||||
@ -282,3 +284,9 @@ void EWOL_GenericDraw(void)
|
|||||||
startTime = -1;
|
startTime = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EWOL_NativeGLDestroy(void)
|
||||||
|
{
|
||||||
|
ewol::UpdateTextureContextIsDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
#include <ewol/Windows.h>
|
#include <ewol/Windows.h>
|
||||||
|
|
||||||
void EWOL_NativeResize(int w, int h );
|
void EWOL_NativeResize(int w, int h );
|
||||||
void EWOL_GenericDraw(void);
|
void EWOL_GenericDraw(bool everyTime);
|
||||||
|
void EWOL_NativeGLDestroy(void);
|
||||||
|
|
||||||
namespace guiAbstraction
|
namespace guiAbstraction
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "AndroidJNI"
|
#define __class__ "AndroidJNI"
|
||||||
int32_t separateClickTime = 200;
|
int32_t separateClickTime = 800;
|
||||||
int32_t offsetMoveClicked = 40;
|
int32_t offsetMoveClicked = 40;
|
||||||
int32_t offsetMoveClickedDouble = 300;
|
int32_t offsetMoveClickedDouble = 300;
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ void EWOL_NativeRender(void)
|
|||||||
|
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
} else {
|
} else {
|
||||||
EWOL_GenericDraw();
|
EWOL_GenericDraw(true);
|
||||||
}
|
}
|
||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
@ -334,9 +334,8 @@ void EWOL_NativeRender(void)
|
|||||||
glColor3f(1., 1., 0.); glVertex3f( .25*(etkFloat_t)gui_width, .75*(etkFloat_t)gui_height, 0.);
|
glColor3f(1., 1., 0.); glVertex3f( .25*(etkFloat_t)gui_width, .75*(etkFloat_t)gui_height, 0.);
|
||||||
glEnd();
|
glEnd();
|
||||||
} else {
|
} else {
|
||||||
EWOL_GenericDraw();
|
EWOL_GenericDraw(false);
|
||||||
}
|
}
|
||||||
// swap the buffers if we have doublebuffered
|
|
||||||
glFlush();
|
glFlush();
|
||||||
if (m_doubleBuffered) {
|
if (m_doubleBuffered) {
|
||||||
glXSwapBuffers(m_display, WindowHandle);
|
glXSwapBuffers(m_display, WindowHandle);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user