GL: Replace CStdGLCtx::Reinitialize with parameter to Clear()

epoxy
Günther Brammer 2016-01-29 03:56:17 +01:00
parent 1b6d3ca770
commit 83cf09db1a
5 changed files with 13 additions and 20 deletions

View File

@ -107,7 +107,7 @@ public:
CStdGLCtx(); // ctor
~CStdGLCtx() { Clear(); } // dtor
void Clear(); // clear objects
void Clear(bool multisample_change = false); // clear objects
#ifdef USE_WIN32_WINDOWS
std::vector<int> EnumerateMultiSamples() const;
@ -119,8 +119,6 @@ public:
bool PageFlip(); // present scene
static void Reinitialize();
protected:
void SelectCommon();
// this handles are declared as pointers to structs

View File

@ -55,17 +55,6 @@ void CStdGLCtx::SelectCommon()
}
}
void CStdGLCtx::Reinitialize()
{
assert(!pGL->pCurrCtx);
#ifdef USE_WIN32_WINDOWS
if (hrc)
wglDeleteContext(hrc);
hrc = 0;
#endif
}
#ifdef USE_WIN32_WINDOWS
#include <GL/wglew.h>
@ -264,7 +253,7 @@ bool CStdGLCtx::InitGlew(HINSTANCE hInst)
CStdGLCtx::CStdGLCtx(): pWindow(0), hDC(0), this_context(contexts.end()) { }
void CStdGLCtx::Clear()
void CStdGLCtx::Clear(bool multisample_change)
{
Deselect();
if (hDC)
@ -279,6 +268,13 @@ void CStdGLCtx::Clear()
contexts.erase(this_context);
this_context = contexts.end();
}
if (multisample_change)
{
assert(!pGL->pCurrCtx);
if (hrc)
wglDeleteContext(hrc);
hrc = 0;
}
}
bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *pApp)
@ -452,7 +448,7 @@ void InitGLXPointers()
CStdGLCtx::CStdGLCtx(): pWindow(0), ctx(0), this_context(contexts.end()) { }
void CStdGLCtx::Clear()
void CStdGLCtx::Clear(bool multisample_change)
{
Deselect();
if (ctx)
@ -586,7 +582,7 @@ bool CStdGLCtx::PageFlip()
CStdGLCtx::CStdGLCtx(): pWindow(0), this_context(contexts.end()) { }
void CStdGLCtx::Clear()
void CStdGLCtx::Clear(bool multisample_change)
{
pWindow = 0;

View File

@ -558,7 +558,7 @@ static NSOpenGLContext* MainContext;
CStdGLCtx::CStdGLCtx(): pWindow(0), this_context(contexts.end()) {}
void CStdGLCtx::Clear()
void CStdGLCtx::Clear(bool multisample_change)
{
Deselect();
setObjectiveCObject(nil);

View File

@ -1060,7 +1060,7 @@ bool C4StartupOptionsDlg::OnGfxMSComboSelChange(C4GUI::ComboBox *pForCombo, int3
// Note: This assumes there is only one GL context (the main context). This
// is true in fullscreen mode, and since the startup dlg is only shown in
// fullscreen mode we are safe this way.
if(pGL) pGL->pMainCtx->Clear();
if(pGL) pGL->pMainCtx->Clear(true);
#endif
int32_t PrevMultiSampling = Config.Graphics.MultiSampling;
Config.Graphics.MultiSampling = idNewSelection;

View File

@ -693,7 +693,6 @@ bool C4Window::ReInit(C4AbstractApp* pApp)
hWindow, NULL, pApp->hInstance, NULL);
if(!hNewRenderWindow) return false;
CStdGLCtx::Reinitialize();
ShowWindow(hNewRenderWindow, SW_SHOW);
DestroyWindow(renderwnd);
renderwnd = hNewRenderWindow;