Commit 06379558 authored by hybrid's avatar hybrid

Extend OpenGL creation under win32 for easy access to OpenGL versions.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2874 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ca751c41
...@@ -74,8 +74,6 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi ...@@ -74,8 +74,6 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
GLuint PixelFormat; GLuint PixelFormat;
if (AntiAlias > 1)
{
// Create a window to test antialiasing support // Create a window to test antialiasing support
const fschar_t* ClassName = __TEXT("GLCIrrDeviceWin32"); const fschar_t* ClassName = __TEXT("GLCIrrDeviceWin32");
HINSTANCE lhInstance = GetModuleHandle(0); HINSTANCE lhInstance = GetModuleHandle(0);
...@@ -126,6 +124,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi ...@@ -126,6 +124,7 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
} }
HDc = GetDC(temporary_wnd); HDc = GetDC(temporary_wnd);
for (u32 i=0; i<5; ++i) for (u32 i=0; i<5; ++i)
{ {
if (i == 1) if (i == 1)
...@@ -194,6 +193,20 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi ...@@ -194,6 +193,20 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
return false; return false;
} }
#ifdef _DEBUG
core::stringc wglExtensions;
#ifdef WGL_ARB_extensions_string
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
if (irrGetExtensionsString)
wglExtensions = irrGetExtensionsString(HDc);
#elif defined(WGL_EXT_extensions_string)
PFNWGLGETEXTENSIONSSTRINGEXTPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT");
if (irrGetExtensionsString)
wglExtensions = irrGetExtensionsString(HDc);
#endif
os::Printer::log("WGL_extensions", wglExtensions);
#endif
#ifdef WGL_ARB_pixel_format #ifdef WGL_ARB_pixel_format
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB"); PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
if (wglChoosePixelFormat_ARB) if (wglChoosePixelFormat_ARB)
...@@ -267,7 +280,6 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi ...@@ -267,7 +280,6 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
wglDeleteContext(HRc); wglDeleteContext(HRc);
ReleaseDC(temporary_wnd, HDc); ReleaseDC(temporary_wnd, HDc);
DestroyWindow(temporary_wnd); DestroyWindow(temporary_wnd);
}
// get hdc // get hdc
HDc=GetDC(Window); HDc=GetDC(Window);
...@@ -330,7 +342,15 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi ...@@ -330,7 +342,15 @@ bool COpenGLDriver::initDriver(irr::SIrrlichtCreationParameters params, CIrrDevi
#ifdef WGL_ARB_create_context #ifdef WGL_ARB_create_context
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"); PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
if (wglCreateContextAttribs_ARB) if (wglCreateContextAttribs_ARB)
HRc=wglCreateContextAttribs_ARB(HDc, 0, NULL); {
int iAttribs[] =
{
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
0
};
HRc=wglCreateContextAttribs_ARB(HDc, 0, iAttribs);
}
else else
#endif #endif
HRc=wglCreateContext(HDc); HRc=wglCreateContext(HDc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment