Add events when the GL rendering context is lost/restored (only affects old SDL backend and Android target right now)
This commit is contained in:
@@ -59,7 +59,10 @@ enum EventType
|
||||
etJoyButtonDown, // 27
|
||||
etJoyButtonUp, // 28
|
||||
|
||||
etSysWM, //29
|
||||
etSysWM, // 29
|
||||
|
||||
etRenderContextLost, // 30
|
||||
etRenderContextRestored, // 31
|
||||
};
|
||||
|
||||
enum EventFlags
|
||||
|
||||
@@ -361,6 +361,12 @@ public:
|
||||
// display lists. So Work around it.
|
||||
gTextureContextVersion++;
|
||||
|
||||
if (mIsOpenGL)
|
||||
{
|
||||
Event contextLost(etRenderContextLost);
|
||||
ProcessEvent(contextLost);
|
||||
}
|
||||
|
||||
mSDLSurface = SDL_SetVideoMode(inWidth, inHeight, 32, mFlags);
|
||||
|
||||
if (mIsOpenGL)
|
||||
@@ -382,6 +388,9 @@ public:
|
||||
mOpenGLContext->IncRef();
|
||||
mPrimarySurface->DecRef();
|
||||
mPrimarySurface = new HardwareSurface(mOpenGLContext);
|
||||
|
||||
Event contextRestored(etRenderContextRestored);
|
||||
ProcessEvent(contextRestored);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -414,6 +423,12 @@ public:
|
||||
// display lists. So Work around it.
|
||||
gTextureContextVersion++;
|
||||
|
||||
if (mIsOpenGL)
|
||||
{
|
||||
Event contextLost(etRenderContextLost);
|
||||
ProcessEvent(contextLost);
|
||||
}
|
||||
|
||||
int w = mIsFullscreen ? sgDesktopWidth : mWidth;
|
||||
int h = mIsFullscreen ? sgDesktopHeight : mHeight;
|
||||
if (mIsFullscreen)
|
||||
@@ -441,6 +456,9 @@ public:
|
||||
mOpenGLContext->IncRef();
|
||||
mPrimarySurface->DecRef();
|
||||
mPrimarySurface = new HardwareSurface(mOpenGLContext);
|
||||
|
||||
Event contextRestored(etRenderContextRestored);
|
||||
ProcessEvent(contextRestored);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -113,7 +113,11 @@ public:
|
||||
void Resize(int inWidth,int inHeight)
|
||||
{
|
||||
ResetHardwareContext();
|
||||
Event contextLost(etRenderContextLost);
|
||||
HandleEvent(contextLost);
|
||||
mHardwareContext->SetWindowSize(inWidth,inHeight);
|
||||
Event contextRestored(etRenderContextRestored);
|
||||
HandleEvent(contextRestored);
|
||||
Event evt(etResize, inWidth, inHeight);
|
||||
HandleEvent(evt);
|
||||
}
|
||||
@@ -314,7 +318,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetHardwareContext();
|
||||
//ResetHardwareContext();
|
||||
sStage->Resize(inWidth,inHeight);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user