1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Request core GL profile.

This commit is contained in:
Sergey Lipskiy 2017-02-05 18:41:49 +07:00
parent a625225323
commit c1bba2afe6
2 changed files with 37 additions and 4 deletions

View File

@ -55,11 +55,10 @@ void DisplayWindowMupen64plus::_setAttributes()
#elif defined(GLES3_1)
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3);
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 1);
#elif defined(OS_MAC_OS_X)
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3);
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 2);
#else
// Do nothing
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_PROFILE_MASK, M64P_GL_CONTEXT_PROFILE_CORE);
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MAJOR_VERSION, 3);
CoreVideo_GL_SetAttribute(M64P_GL_CONTEXT_MINOR_VERSION, 3);
#endif
#ifndef GLES2

View File

@ -1,5 +1,6 @@
#include <stdio.h>
#include <Graphics/OpenGLContext/GLFunctions.h>
#include <GL/wglext.h>
#include <windows/GLideN64_Windows.h>
#include <GLideN64.h>
#include <Config.h>
@ -91,6 +92,39 @@ bool DisplayWindowWindows::_start()
return false;
}
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB =
(PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
if (wglGetExtensionsStringARB != NULL) {
const char * wglextensions = wglGetExtensionsStringARB(hDC);
if (strstr(wglextensions, "WGL_ARB_create_context") != nullptr &&
strstr(wglextensions, "WGL_ARB_create_context_profile") != nullptr) {
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB =
(PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
GLint majorVersion = 0;
glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
GLint minorVersion = 0;
glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
const int attribList[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, majorVersion,
WGL_CONTEXT_MINOR_VERSION_ARB, minorVersion,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
0 //End
};
HGLRC coreHrc = wglCreateContextAttribsARB(hDC, 0, attribList);
if (coreHrc != NULL) {
wglDeleteContext(hRC);
wglMakeCurrent(hDC, coreHrc);
hRC = coreHrc;
}
}
}
return _resizeWindow();
}