Changed GL context creation a bit

This commit is contained in:
korenkonder
2023-12-19 21:37:47 +03:00
parent 7b1be9e98a
commit 0973e810eb
3 changed files with 13 additions and 21 deletions
+13 -9
View File
@@ -92,21 +92,25 @@ static HGLRC FASTCALL glut_create_context(int64_t a1, int64_t a2, int64_t a3, in
wrap_addresses();
if (true/*a5*/) {
const int32_t attrib_list[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
0,
};
typedef HGLRC(GLAPIENTRY* PFNWGLCREATECONTEXTGLUTPROC)(HDC hDc);
HGLRC tmp_ctx = wglCreateContextGLUT(hDc);;
wglMakeCurrentGLUT(hDc, tmp_ctx);
PFNWGLCREATECONTEXTATTRIBSARBPROC _wglCreateContextAttribsARB
= (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddressGLUT("wglCreateContextAttribsARB");
HGLRC ctx = _wglCreateContextAttribsARB(hDc, 0, attrib_list);
int32_t minor = 6;
HGLRC ctx = 0;
while (!ctx || minor < 3) {
const int32_t attrib_list[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
WGL_CONTEXT_MINOR_VERSION_ARB, minor,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
0,
};
ctx = _wglCreateContextAttribsARB(hDc, 0, attrib_list);;
}
wglMakeCurrentGLUT(hDc, ctx);
wglDeleteContextGLUT(tmp_ctx);
return ctx;
-8
View File
@@ -1583,10 +1583,6 @@ gl_func_struct gl_addr_glut[7] = {
{ 0x000000000002A430, 0, }, // wglMakeCurrent
};
bool GL_VERSION_3_3 = false;
bool GL_VERSION_4_0 = false;
bool GL_VERSION_4_1 = false;
bool GL_VERSION_4_2 = false;
bool GL_VERSION_4_3 = false;
bool GL_VERSION_4_4 = false;
bool GL_VERSION_4_5 = false;
@@ -1666,10 +1662,6 @@ void wrap_addresses() {
int32_t minor;
sscanf_s(version, "%d.%d", &major, &minor);
GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3;
GL_VERSION_4_0 = (major == 4 && minor >= 0) || major > 4;
GL_VERSION_4_1 = (major == 4 && minor >= 1) || major > 4;
GL_VERSION_4_2 = (major == 4 && minor >= 2) || major > 4;
GL_VERSION_4_3 = (major == 4 && minor >= 3) || major > 4;
GL_VERSION_4_4 = (major == 4 && minor >= 4) || major > 4;
GL_VERSION_4_5 = (major == 4 && minor >= 5) || major > 4;
-4
View File
@@ -3245,10 +3245,6 @@ extern gl_func_struct gl_addr_glut[7];
#define wglGetProcAddressGLUT ((PFNWGLGETPROCADDRESSGLUTPROC)gl_addr_glut[WGLGETPROCADDRESSGLUT].func)
#define wglMakeCurrentGLUT ((PFNWGLMAKECURRENTGLUTPROC)gl_addr_glut[WGLMAKECURRENTGLUT].func)
extern bool GL_VERSION_3_3;
extern bool GL_VERSION_4_0;
extern bool GL_VERSION_4_1;
extern bool GL_VERSION_4_2;
extern bool GL_VERSION_4_3;
extern bool GL_VERSION_4_4;
extern bool GL_VERSION_4_5;