From d6fe447ca9ef60ded91a09879b36c08b0b322a9f Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 13 Sep 2010 18:05:59 +0200 Subject: [PATCH] Added glfwGetVersionString. --- include/GL/glfw3.h | 1 + readme.html | 1 + src/init.c | 10 ++++++++++ src/internal.h | 7 ++++--- src/x11/x11_config.h.cmake | 2 ++ src/x11/x11_init.c | 29 +++++++++++++++++++++++++++++ 6 files changed, 47 insertions(+), 3 deletions(-) diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 07c93a2f..588b52ab 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -399,6 +399,7 @@ typedef void (* GLFWcharfun)(GLFWwindow,int); GLFWAPI int glfwInit(void); GLFWAPI void glfwTerminate(void); GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev); +GLFWAPI const char* glfwGetVersionString(void); /* Error handling */ GLFWAPI int glfwGetError(void); diff --git a/readme.html b/readme.html index c0a4db50..8e439073 100644 --- a/readme.html +++ b/readme.html @@ -266,6 +266,7 @@ version of GLFW.

  • Added glfwMakeWindowCurrent function for making the context of the specified window current
  • Added glfwGetError and glfwErrorString error reporting functions and a number of error tokens
  • Added glfwSetWindowUserPointer and glfwGetWindowUserPointer functions for per-window user pointers
  • +
  • Added glfwGetVersionString function for determining which code paths were enabled at compile time
  • Added windows simple multi-window test program
  • Changed buffer bit depth parameters of glfwOpenWindow to window hints
  • Renamed lib source code directory to src
  • diff --git a/src/init.c b/src/init.c index dbf14e85..200e22c1 100644 --- a/src/init.c +++ b/src/init.c @@ -97,3 +97,13 @@ GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev) *rev = GLFW_VERSION_REVISION; } + +//======================================================================== +// Get the GLFW version string +//======================================================================== + +GLFWAPI const char* glfwGetVersionString(void) +{ + return _glfwPlatformGetVersionString(); +} + diff --git a/src/internal.h b/src/internal.h index e49277c3..2c60e507 100644 --- a/src/internal.h +++ b/src/internal.h @@ -235,9 +235,7 @@ GLFWGLOBAL _GLFWlibrary _glfwLibrary; // Init/terminate int _glfwPlatformInit(void); int _glfwPlatformTerminate(void); - -// Error handling -void _glfwSetError(int error); +const char* _glfwPlatformGetVersionString(void); // Enable/Disable void _glfwPlatformEnableSystemKeys(_GLFWwindow* window); @@ -285,6 +283,9 @@ void* _glfwPlatformGetProcAddress(const char* procname); // Prototypes for platform independent internal functions //======================================================================== +// Error handling +void _glfwSetError(int error); + // Window management (window.c) void _glfwClearWindowHints(void); diff --git a/src/x11/x11_config.h.cmake b/src/x11/x11_config.h.cmake index d578d574..465fd645 100644 --- a/src/x11/x11_config.h.cmake +++ b/src/x11/x11_config.h.cmake @@ -12,3 +12,5 @@ /* Define this to 1 if glXGetProcAddressEXT is available */ #cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT 1 +#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@" + diff --git a/src/x11/x11_init.c b/src/x11/x11_init.c index a9260a16..a238b105 100644 --- a/src/x11/x11_init.c +++ b/src/x11/x11_init.c @@ -247,3 +247,32 @@ int _glfwPlatformTerminate(void) return GL_TRUE; } +//======================================================================== +// Get the GLFW version string +//======================================================================== + +const char* _glfwPlatformGetVersionString(void) +{ + const char* version = "GLFW " _GLFW_VERSION_FULL +#if defined(_GLFW_HAS_XRANDR) + " XRandR" +#elif defined(_GLFW_HAS_XF86VIDMODE) + " Xf86VidMode" +#endif +#if defined(_GLFW_HAS_GLXGETPROCADDRESS) + " glXGetProcAddress" +#elif defined(_GLFW_HAS_GLXGETPROCADDRESSARB) + " glXGetProcAddressARB" +#elif defined(_GLFW_HAS_GLXGETPROCADDRESSEXT) + " glXGetProcAddressEXT" +#elif defined(_GLFW_DLOPEN_LIBGL) + " dlopen(libGL)" +#endif +#if defined(_GLFW_USE_LINUX_JOYSTICKS) + " Linux joystick API" +#endif + ; + + return version; +} +