Refactoring only (replace nested conditionals with guard clauses), making the normal path of execution much clearer.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@770 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
3a8ad4ac32
commit
c6a956ed14
@ -302,22 +302,34 @@ typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShar
|
|||||||
|
|
||||||
GLboolean fgNewWGLCreateContext( SFG_Window* window )
|
GLboolean fgNewWGLCreateContext( SFG_Window* window )
|
||||||
{
|
{
|
||||||
|
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetEntensionsStringARB;
|
||||||
|
|
||||||
if( (fgState.ContextFlags & GLUT_FORWARD_COMPATIBLE) &&
|
if( (fgState.ContextFlags & GLUT_FORWARD_COMPATIBLE) &&
|
||||||
(fgState.MajorVersion > 2) )
|
(fgState.MajorVersion > 2) )
|
||||||
{
|
{
|
||||||
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetEntensionsStringARB=NULL;
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
wglMakeCurrent( window->Window.Device,
|
wglMakeCurrent( window->Window.Device,
|
||||||
window->Window.Context );
|
window->Window.Context );
|
||||||
|
|
||||||
wglGetEntensionsStringARB=(PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
wglGetEntensionsStringARB=(PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||||
if (wglGetEntensionsStringARB)
|
if ( wglGetEntensionsStringARB == NULL )
|
||||||
{
|
{
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
const char * pWglExtString=wglGetEntensionsStringARB(window->Window.Device);
|
const char * pWglExtString=wglGetEntensionsStringARB(window->Window.Device);
|
||||||
if (pWglExtString)
|
if ( pWglExtString == NULL )
|
||||||
{
|
{
|
||||||
if (strstr(pWglExtString, "WGL_ARB_create_context"))
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( strstr(pWglExtString, "WGL_ARB_create_context") == NULL )
|
||||||
{
|
{
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* new context creation */
|
/* new context creation */
|
||||||
HGLRC context;
|
HGLRC context;
|
||||||
int attribs[7];
|
int attribs[7];
|
||||||
@ -351,10 +363,6 @@ GLboolean fgNewWGLCreateContext( SFG_Window* window )
|
|||||||
wglDeleteContext( window->Window.Context );
|
wglDeleteContext( window->Window.Context );
|
||||||
window->Window.Context = context;
|
window->Window.Context = context;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user