From e14fe3fb409dbe9dc04f7064bcd007789672d136 Mon Sep 17 00:00:00 2001 From: Sven Panne Date: Fri, 13 Feb 2009 18:24:46 +0000 Subject: [PATCH] More refactorings: Removed useless return value. Simplified control structures even more. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@771 7f0cb862-5218-0410-a997-914c9d46530a --- src/freeglut_internal.h | 2 +- src/freeglut_window.c | 33 +++++++++++---------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/freeglut_internal.h b/src/freeglut_internal.h index 4f8fd96..357e8b9 100644 --- a/src/freeglut_internal.h +++ b/src/freeglut_internal.h @@ -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 diff --git a/src/freeglut_window.c b/src/freeglut_window.c index 7b87792..bce206e 100644 --- a/src/freeglut_window.c +++ b/src/freeglut_window.c @@ -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 ) - { - return GL_TRUE; - } - - if ( strstr(pWglExtString, "WGL_ARB_create_context") == NULL ) + if (( pWglExtString == NULL ) || ( 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; } -- 1.7.10.4