Новый метод отрисовки в движке сменил старый wglCreateContext на новый. Теперь можно управлять версией OpenGL прям в движке.
#include <GL/GL.h>
typedef HGLRC(WINAPI* PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int* attribList);
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_FLAGS_ARB 0x2094
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL;
HGLRC CreateGL(HDC hDC, int major, int minor)
{
HGLRC hRC_temp = wglCreateContext(hDC);
if (!hRC_temp) return NULL;
if (!wglMakeCurrent(hDC, hRC_temp))
{
wglDeleteContext(hRC_temp);
return NULL;
}
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
if (!wglCreateContextAttribsARB)
{
wglMakeCurrent(NULL, NULL);
return hRC_temp;
}
const int attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, major,
WGL_CONTEXT_MINOR_VERSION_ARB, minor,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
0
};
HGLRC hRC_final = wglCreateContextAttribsARB(hDC, 0, attribs);
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hRC_temp);
return hRC_final;
}
го играть со мной на твич https://www.twitch.tv/hcpp20334_
Twitch
HCPP20334_ - Twitch
DVD Bound Live | My C++ GameEngine Test
This media is not supported in the widget
VIEW IN TELEGRAM
перезапустил стрим https://youtube.com/live/nFg1YHAJbqY?feature=share
YouTube
Общение + Разработка на С++20) | C++ Dev
на контент
💸 https://new.donatepay.ru/@1128636
memealerts скинь мемы на стрим
💸 https://memealerts.com/6622627192bcc2dd29fa23a7
========== МОЙ КОНТАКТЫ ДЛЯ СВЯЗИ ==================
тгк: https://t.me/hcppdev
мой тг: https://t.me/hcppstudio
Мой гитхаб / My…
💸 https://new.donatepay.ru/@1128636
memealerts скинь мемы на стрим
💸 https://memealerts.com/6622627192bcc2dd29fa23a7
========== МОЙ КОНТАКТЫ ДЛЯ СВЯЗИ ==================
тгк: https://t.me/hcppdev
мой тг: https://t.me/hcppstudio
Мой гитхаб / My…