More refactorings: Removed useless return value. Simplified control structures even more.

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@771 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
spanne 2009-02-13 18:24:46 +00:00
parent c6a956ed14
commit 335315c378
2 changed files with 12 additions and 23 deletions

View File

@ -813,7 +813,7 @@ GLXFBConfig* fgChooseFBConfig( void );
#if TARGET_HOST_MS_WINDOWS
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam );
GLboolean fgNewWGLCreateContext( SFG_Window* window );
void fgNewWGLCreateContext( SFG_Window* window );
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
unsigned char layer_type );
#endif

View File

@ -300,14 +300,17 @@ typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShar
#endif
GLboolean fgNewWGLCreateContext( SFG_Window* window )
void fgNewWGLCreateContext( SFG_Window* window )
{
PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetEntensionsStringARB;
HGLRC context;
int attribs[7];
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
if( (fgState.ContextFlags & GLUT_FORWARD_COMPATIBLE) &&
(fgState.MajorVersion > 2) )
{
return GL_TRUE;
return;
}
wglMakeCurrent( window->Window.Device,
@ -316,25 +319,16 @@ GLboolean fgNewWGLCreateContext( SFG_Window* window )
wglGetEntensionsStringARB=(PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
if ( wglGetEntensionsStringARB == NULL )
{
return GL_TRUE;
return;
}
const char * pWglExtString=wglGetEntensionsStringARB(window->Window.Device);
if ( pWglExtString == NULL )
if (( pWglExtString == NULL ) || ( strstr(pWglExtString, "WGL_ARB_create_context") == NULL ))
{
return GL_TRUE;
}
if ( strstr(pWglExtString, "WGL_ARB_create_context") == NULL )
{
return GL_TRUE;
return;
}
/* new context creation */
HGLRC context;
int attribs[7];
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
attribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB;
attribs[1] = fgState.MajorVersion;
attribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB;
@ -356,15 +350,10 @@ GLboolean fgNewWGLCreateContext( SFG_Window* window )
fgError( "Unable to create OpenGL %d.%d context (flags %x)",
fgState.MajorVersion, fgState.MinorVersion, fgState.ContextFlags );
}
else
{
fgWarning( "Success 3.0" );
wglMakeCurrent( NULL, NULL );
wglDeleteContext( window->Window.Context );
window->Window.Context = context;
}
return GL_TRUE;
wglMakeCurrent( NULL, NULL );
wglDeleteContext( window->Window.Context );
window->Window.Context = context;
}