Test alternative functions for binding contexts on GL

This commit is contained in:
baldurk
2022-04-28 14:05:38 +01:00
parent 7066692262
commit c1240effe3
4 changed files with 23 additions and 8 deletions
+3
View File
@@ -181,6 +181,9 @@ void main()
}
#endif
ActivateContext(NULL, NULL);
ActivateContext(mainWindow, mainContext, true);
while(Running())
{
// trash the texture pack/unpack state
+1 -1
View File
@@ -40,7 +40,7 @@ struct OpenGLGraphicsTest : public GraphicsTest
GraphicsWindow *MakeWindow(int width, int height, const char *title);
void *MakeContext(GraphicsWindow *win, void *share);
void DestroyContext(void *ctx);
void ActivateContext(GraphicsWindow *win, void *ctx);
void ActivateContext(GraphicsWindow *win, void *ctx, bool alt = false);
void PostInit();
+10 -4
View File
@@ -224,18 +224,24 @@ void OpenGLGraphicsTest::DestroyContext(void *ctx)
glXDestroyContext(x11win->xlib.display, (GLXContext)ctx);
}
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx)
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx, bool alt)
{
X11Window *x11win = (X11Window *)win;
if(ctx == NULL)
{
glXMakeContextCurrent(x11win->xlib.display, (GLXDrawable)NULL, (GLXDrawable)NULL, NULL);
if(glXMakeCurrent && alt)
glXMakeCurrent(x11win->xlib.display, (GLXDrawable)NULL, NULL);
else
glXMakeContextCurrent(x11win->xlib.display, (GLXDrawable)NULL, (GLXDrawable)NULL, NULL);
return;
}
glXMakeContextCurrent(x11win->xlib.display, x11win->xlib.window, x11win->xlib.window,
(GLXContext)ctx);
if(glXMakeCurrent && alt)
glXMakeCurrent(x11win->xlib.display, x11win->xlib.window, (GLXContext)ctx);
else
glXMakeContextCurrent(x11win->xlib.display, x11win->xlib.window, x11win->xlib.window,
(GLXContext)ctx);
}
void OpenGLGraphicsTest::Present(GraphicsWindow *window)
+9 -3
View File
@@ -258,11 +258,14 @@ void OpenGLGraphicsTest::DestroyContext(void *ctx)
deleteContext((HGLRC)ctx);
}
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx)
void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx, bool alt)
{
if(ctx == NULL)
{
makeCurrent(NULL, NULL);
if(alt && wglMakeContextCurrentARB)
wglMakeContextCurrentARB(NULL, NULL, NULL);
else
makeCurrent(NULL, NULL);
return;
}
@@ -270,7 +273,10 @@ void OpenGLGraphicsTest::ActivateContext(GraphicsWindow *win, void *ctx)
HDC dc = GetDC(win32win->wnd);
makeCurrent(dc, (HGLRC)ctx);
if(alt && wglMakeContextCurrentARB)
wglMakeContextCurrentARB(dc, dc, (HGLRC)ctx);
else
makeCurrent(dc, (HGLRC)ctx);
ReleaseDC(win32win->wnd, dc);
}