# HG changeset patch # User Matti Hamalainen # Date 1575652884 -7200 # Node ID d871e4b2432879d959306f62e10b95a1f6223cd2 # Parent 6343c3392a958d8385d2b196b27ce530e8b9471c Be less verbose when checking for GL extensions, only inform when something is NOT found. diff -r 6343c3392a95 -r d871e4b24328 gldragon.cpp --- a/gldragon.cpp Fri Dec 06 19:09:47 2019 +0200 +++ b/gldragon.cpp Fri Dec 06 19:21:24 2019 +0200 @@ -47,13 +47,14 @@ #undef DM_GLEXT_INIT -bool dmGLCheckExtension(const std::string &name) +void dmGLCheckExtension(const std::string &name, bool &status) { - bool res = SDL_GL_ExtensionSupported("GL_ARB_shader_objects"); - dmMsg(" - Have '%s'? %s\n", - name.c_str(), - res ? "YES" : "no"); - return res; + if (!SDL_GL_ExtensionSupported(name.c_str())) + { + status = false; + dmMsg(" - '%s' NOT supported.\n", + name.c_str()); + } } @@ -61,9 +62,8 @@ { void *ptr = SDL_GL_GetProcAddress(name.c_str()); - dmMsg(" - Have '%s'? %s\n", - name.c_str(), - ptr != NULL ? "YES" : "no"); + if (ptr == NULL) + dmMsg(" - '%s' NOT supported.\n"); return ptr; } @@ -77,7 +77,6 @@ (ptr = dmGLGetProcAddr(name + "EXT")) != NULL || (ptr = dmGLGetProcAddr(name + "ARB")) != NULL; - if (!ok) status = false; @@ -88,27 +87,26 @@ bool dmInitGLExtensions(void) { -#ifdef GL_GLEXT_PROTOTYPES - return true; -#else bool status = true; - dmMsg("Checking for required OpenGL extensions ..\n"); - if (!dmGLCheckExtension("GL_ARB_shader_objects") || - !dmGLCheckExtension("GL_ARB_shading_language_100") || - !dmGLCheckExtension("GL_ARB_vertex_shader") || - !dmGLCheckExtension("GL_ARB_fragment_shader")) +#ifndef GL_GLEXT_PROTOTYPES + dmGLCheckExtension("GL_ARB_shader_objects", status); + dmGLCheckExtension("GL_ARB_shading_language_100", status); + dmGLCheckExtension("GL_ARB_vertex_shader", status); + dmGLCheckExtension("GL_ARB_fragment_shader", status); + if (!status) { - dmError("Required OpenGL extensions not supported.\n"); + dmError("One or more of the required OpenGL extensions not supported.\n"); return false; } #define DM_GLEXT_INIT(extproctype, extprocname) \ extprocname = (extproctype) dmGLExtInit(#extprocname, status); #include "dmglexts.h" +#endif + return status; -#endif }