Made glfwGetProcAddress return a function pointer.

This commit is contained in:
Camilla Berglund 2012-06-05 00:16:40 +02:00
parent bc8860dc6a
commit bf42c3cfbc
7 changed files with 14 additions and 10 deletions

View File

@ -470,6 +470,9 @@ extern "C" {
* Typedefs * Typedefs
*************************************************************************/ *************************************************************************/
/* OpenGL function pointer type */
typedef void (*GLFWglproc)(void);
/* Window handle type */ /* Window handle type */
typedef void* GLFWwindow; typedef void* GLFWwindow;
@ -589,7 +592,7 @@ GLFWAPI GLFWwindow glfwGetCurrentContext(void);
GLFWAPI void glfwSwapBuffers(void); GLFWAPI void glfwSwapBuffers(void);
GLFWAPI void glfwSwapInterval(int interval); GLFWAPI void glfwSwapInterval(int interval);
GLFWAPI int glfwExtensionSupported(const char* extension); GLFWAPI int glfwExtensionSupported(const char* extension);
GLFWAPI void* glfwGetProcAddress(const char* procname); GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
GLFWAPI void glfwCopyContext(GLFWwindow src, GLFWwindow dst, unsigned long mask); GLFWAPI void glfwCopyContext(GLFWwindow src, GLFWwindow dst, unsigned long mask);

View File

@ -292,6 +292,7 @@ version of GLFW.</p>
<li>Added <code>glfwSetGamma</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li> <li>Added <code>glfwSetGamma</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li>
<li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li> <li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li>
<li>Changed <code>glfwOpenWindow</code> and <code>glfwSetWindowTitle</code> to use UTF-8 encoded strings</li> <li>Changed <code>glfwOpenWindow</code> and <code>glfwSetWindowTitle</code> to use UTF-8 encoded strings</li>
<li>Changed <code>glfwGetProcAddress</code> to return a (generic) function pointer</li>
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li> <li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
<li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li> <li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li>
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_WINDOW_RESIZABLE</code></li> <li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_WINDOW_RESIZABLE</code></li>

View File

@ -88,13 +88,13 @@ int _glfwPlatformExtensionSupported(const char* extension)
// Get the function pointer to an OpenGL function // Get the function pointer to an OpenGL function
//======================================================================== //========================================================================
void* _glfwPlatformGetProcAddress(const char* procname) GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
{ {
CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault, CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault,
procname, procname,
kCFStringEncodingASCII); kCFStringEncodingASCII);
void* symbol = CFBundleGetFunctionPointerForName(_glfwLibrary.NSGL.framework, GLFWglproc symbol = CFBundleGetFunctionPointerForName(_glfwLibrary.NSGL.framework,
symbolName); symbolName);
CFRelease(symbolName); CFRelease(symbolName);

View File

@ -327,7 +327,7 @@ void _glfwPlatformSwapBuffers(void);
void _glfwPlatformSwapInterval(int interval); void _glfwPlatformSwapInterval(int interval);
void _glfwPlatformRefreshWindowParams(void); void _glfwPlatformRefreshWindowParams(void);
int _glfwPlatformExtensionSupported(const char* extension); int _glfwPlatformExtensionSupported(const char* extension);
void* _glfwPlatformGetProcAddress(const char* procname); GLFWglproc _glfwPlatformGetProcAddress(const char* procname);
void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask); void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask);

View File

@ -613,7 +613,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
// This function can be used to get access to extended OpenGL functions. // This function can be used to get access to extended OpenGL functions.
//======================================================================== //========================================================================
GLFWAPI void* glfwGetProcAddress(const char* procname) GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {

View File

@ -111,9 +111,9 @@ int _glfwPlatformExtensionSupported(const char* extension)
// Get the function pointer to an OpenGL function // Get the function pointer to an OpenGL function
//======================================================================== //========================================================================
void* _glfwPlatformGetProcAddress(const char* procname) GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
{ {
return (void*) wglGetProcAddress(procname); return wglGetProcAddress(procname);
} }

View File

@ -752,9 +752,9 @@ int _glfwPlatformExtensionSupported(const char* extension)
// Get the function pointer to an OpenGL function // Get the function pointer to an OpenGL function
//======================================================================== //========================================================================
void* _glfwPlatformGetProcAddress(const char* procname) GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
{ {
return (void*) _glfw_glXGetProcAddress((const GLubyte*) procname); return _glfw_glXGetProcAddress((const GLubyte*) procname);
} }