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 #if TARGET_HOST_MS_WINDOWS
LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam ); WPARAM wParam, LPARAM lParam );
GLboolean fgNewWGLCreateContext( SFG_Window* window ); void fgNewWGLCreateContext( SFG_Window* window );
GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly,
unsigned char layer_type ); unsigned char layer_type );
#endif #endif

View File

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