diff --git a/src/egl_context.c b/src/egl_context.c index 3c2fc3a9..e35076d8 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -34,7 +34,7 @@ // Return a description of the specified EGL error // -static const char* getErrorString(EGLint error) +static const char* getEGLErrorString(EGLint error) { switch (error) { @@ -75,16 +75,16 @@ static const char* getErrorString(EGLint error) // Returns the specified attribute of the specified EGLConfig // -static int getConfigAttrib(EGLConfig config, int attrib) +static int getEGLConfigAttrib(EGLConfig config, int attrib) { int value; eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value); return value; } -// Return a list of available and usable framebuffer configs +// Return the EGLConfig most closely matching the specified hints // -static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig, +static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* desired, EGLConfig* result) { @@ -112,16 +112,16 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig, _GLFWfbconfig* u = usableConfigs + usableCount; // Only consider RGB(A) EGLConfigs - if (!(getConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) & EGL_RGB_BUFFER)) + if (!(getEGLConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) & EGL_RGB_BUFFER)) continue; // Only consider window EGLConfigs - if (!(getConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT)) + if (!(getEGLConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT)) continue; #if defined(_GLFW_X11) // Only consider EGLConfigs with associated Visuals - if (!getConfigAttrib(n, EGL_NATIVE_VISUAL_ID)) + if (!getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID)) continue; #endif // _GLFW_X11 @@ -129,30 +129,30 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig, { if (ctxconfig->major == 1) { - if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT)) + if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT)) continue; } else { - if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT)) + if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT)) continue; } } else if (ctxconfig->client == GLFW_OPENGL_API) { - if (!(getConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT)) + if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT)) continue; } - u->redBits = getConfigAttrib(n, EGL_RED_SIZE); - u->greenBits = getConfigAttrib(n, EGL_GREEN_SIZE); - u->blueBits = getConfigAttrib(n, EGL_BLUE_SIZE); + u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE); + u->greenBits = getEGLConfigAttrib(n, EGL_GREEN_SIZE); + u->blueBits = getEGLConfigAttrib(n, EGL_BLUE_SIZE); - u->alphaBits = getConfigAttrib(n, EGL_ALPHA_SIZE); - u->depthBits = getConfigAttrib(n, EGL_DEPTH_SIZE); - u->stencilBits = getConfigAttrib(n, EGL_STENCIL_SIZE); + u->alphaBits = getEGLConfigAttrib(n, EGL_ALPHA_SIZE); + u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE); + u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE); - u->samples = getConfigAttrib(n, EGL_SAMPLES); + u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); u->doublebuffer = GLFW_TRUE; u->handle = (uintptr_t) n; @@ -169,7 +169,7 @@ static GLFWbool chooseFBConfigs(const _GLFWctxconfig* ctxconfig, return closest != NULL; } -static void makeContextCurrent(_GLFWwindow* window) +static void makeContextCurrentEGL(_GLFWwindow* window) { if (window) { @@ -180,7 +180,7 @@ static void makeContextCurrent(_GLFWwindow* window) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to make context current: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); return; } } @@ -193,7 +193,7 @@ static void makeContextCurrent(_GLFWwindow* window) { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to clear current context: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); return; } } @@ -201,7 +201,7 @@ static void makeContextCurrent(_GLFWwindow* window) _glfwPlatformSetCurrentContext(window); } -static void swapBuffers(_GLFWwindow* window) +static void swapBuffersEGL(_GLFWwindow* window) { if (window != _glfwPlatformGetCurrentContext()) { @@ -213,12 +213,12 @@ static void swapBuffers(_GLFWwindow* window) eglSwapBuffers(_glfw.egl.display, window->context.egl.surface); } -static void swapInterval(int interval) +static void swapIntervalEGL(int interval) { eglSwapInterval(_glfw.egl.display, interval); } -static int extensionSupported(const char* extension) +static int extensionSupportedEGL(const char* extension) { const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS); if (extensions) @@ -230,7 +230,7 @@ static int extensionSupported(const char* extension) return GLFW_FALSE; } -static GLFWglproc getProcAddress(const char* procname) +static GLFWglproc getProcAddressEGL(const char* procname) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); @@ -245,7 +245,7 @@ static GLFWglproc getProcAddress(const char* procname) return eglGetProcAddress(procname); } -static void destroyContext(_GLFWwindow* window) +static void destroyContextEGL(_GLFWwindow* window) { #if defined(_GLFW_X11) // NOTE: Do not unload libGL.so.1 while the X11 display is still open, @@ -344,7 +344,7 @@ GLFWbool _glfwInitEGL(void) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to get EGL display: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); _glfwTerminateEGL(); return GLFW_FALSE; @@ -354,18 +354,18 @@ GLFWbool _glfwInitEGL(void) { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to initialize EGL: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); _glfwTerminateEGL(); return GLFW_FALSE; } _glfw.egl.KHR_create_context = - extensionSupported("EGL_KHR_create_context"); + extensionSupportedEGL("EGL_KHR_create_context"); _glfw.egl.KHR_create_context_no_error = - extensionSupported("EGL_KHR_create_context_no_error"); + extensionSupportedEGL("EGL_KHR_create_context_no_error"); _glfw.egl.KHR_gl_colorspace = - extensionSupported("EGL_KHR_gl_colorspace"); + extensionSupportedEGL("EGL_KHR_gl_colorspace"); return GLFW_TRUE; } @@ -413,7 +413,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, if (ctxconfig->share) share = ctxconfig->share->context.egl.handle; - if (!chooseFBConfigs(ctxconfig, fbconfig, &config)) + if (!chooseEGLConfig(ctxconfig, fbconfig, &config)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Failed to find a suitable EGLConfig"); @@ -426,7 +426,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to bind OpenGL ES: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); return GLFW_FALSE; } } @@ -436,7 +436,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, { _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Failed to bind OpenGL: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); return GLFW_FALSE; } } @@ -515,7 +515,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, { _glfwInputError(GLFW_VERSION_UNAVAILABLE, "EGL: Failed to create context: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); return GLFW_FALSE; } @@ -543,7 +543,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, { _glfwInputError(GLFW_PLATFORM_ERROR, "EGL: Failed to create window surface: %s", - getErrorString(eglGetError())); + getEGLErrorString(eglGetError())); return GLFW_FALSE; } @@ -613,12 +613,12 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, } } - window->context.makeCurrent = makeContextCurrent; - window->context.swapBuffers = swapBuffers; - window->context.swapInterval = swapInterval; - window->context.extensionSupported = extensionSupported; - window->context.getProcAddress = getProcAddress; - window->context.destroy = destroyContext; + window->context.makeCurrent = makeContextCurrentEGL; + window->context.swapBuffers = swapBuffersEGL; + window->context.swapInterval = swapIntervalEGL; + window->context.extensionSupported = extensionSupportedEGL; + window->context.getProcAddress = getProcAddressEGL; + window->context.destroy = destroyContextEGL; return GLFW_TRUE; } @@ -638,7 +638,7 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWctxconfig* ctxconfig, EGLint visualID = 0, count = 0; const long vimask = VisualScreenMask | VisualIDMask; - if (!chooseFBConfigs(ctxconfig, fbconfig, &native)) + if (!chooseEGLConfig(ctxconfig, fbconfig, &native)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Failed to find a suitable EGLConfig"); diff --git a/src/glx_context.c b/src/glx_context.c index 792f44ee..b96baad6 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -38,16 +38,16 @@ // Returns the specified attribute of the specified GLXFBConfig // -static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib) +static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib) { int value; glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value); return value; } -// Return a list of available and usable framebuffer configs +// Return the GLXFBConfig most closely matching the specified hints // -static GLFWbool chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result) +static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result) { GLXFBConfig* nativeConfigs; _GLFWfbconfig* usableConfigs; @@ -79,41 +79,41 @@ static GLFWbool chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result _GLFWfbconfig* u = usableConfigs + usableCount; // Only consider RGBA GLXFBConfigs - if (!(getFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT)) + if (!(getGLXFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT)) continue; // Only consider window GLXFBConfigs - if (!(getFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT)) + if (!(getGLXFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT)) { if (trustWindowBit) continue; } - u->redBits = getFBConfigAttrib(n, GLX_RED_SIZE); - u->greenBits = getFBConfigAttrib(n, GLX_GREEN_SIZE); - u->blueBits = getFBConfigAttrib(n, GLX_BLUE_SIZE); + u->redBits = getGLXFBConfigAttrib(n, GLX_RED_SIZE); + u->greenBits = getGLXFBConfigAttrib(n, GLX_GREEN_SIZE); + u->blueBits = getGLXFBConfigAttrib(n, GLX_BLUE_SIZE); - u->alphaBits = getFBConfigAttrib(n, GLX_ALPHA_SIZE); - u->depthBits = getFBConfigAttrib(n, GLX_DEPTH_SIZE); - u->stencilBits = getFBConfigAttrib(n, GLX_STENCIL_SIZE); + u->alphaBits = getGLXFBConfigAttrib(n, GLX_ALPHA_SIZE); + u->depthBits = getGLXFBConfigAttrib(n, GLX_DEPTH_SIZE); + u->stencilBits = getGLXFBConfigAttrib(n, GLX_STENCIL_SIZE); - u->accumRedBits = getFBConfigAttrib(n, GLX_ACCUM_RED_SIZE); - u->accumGreenBits = getFBConfigAttrib(n, GLX_ACCUM_GREEN_SIZE); - u->accumBlueBits = getFBConfigAttrib(n, GLX_ACCUM_BLUE_SIZE); - u->accumAlphaBits = getFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE); + u->accumRedBits = getGLXFBConfigAttrib(n, GLX_ACCUM_RED_SIZE); + u->accumGreenBits = getGLXFBConfigAttrib(n, GLX_ACCUM_GREEN_SIZE); + u->accumBlueBits = getGLXFBConfigAttrib(n, GLX_ACCUM_BLUE_SIZE); + u->accumAlphaBits = getGLXFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE); - u->auxBuffers = getFBConfigAttrib(n, GLX_AUX_BUFFERS); + u->auxBuffers = getGLXFBConfigAttrib(n, GLX_AUX_BUFFERS); - if (getFBConfigAttrib(n, GLX_STEREO)) + if (getGLXFBConfigAttrib(n, GLX_STEREO)) u->stereo = GLFW_TRUE; - if (getFBConfigAttrib(n, GLX_DOUBLEBUFFER)) + if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER)) u->doublebuffer = GLFW_TRUE; if (_glfw.glx.ARB_multisample) - u->samples = getFBConfigAttrib(n, GLX_SAMPLES); + u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES); if (_glfw.glx.ARB_framebuffer_sRGB || _glfw.glx.EXT_framebuffer_sRGB) - u->sRGB = getFBConfigAttrib(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); + u->sRGB = getGLXFBConfigAttrib(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB); u->handle = (uintptr_t) n; usableCount++; @@ -131,9 +131,9 @@ static GLFWbool chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* result // Create the OpenGL context using legacy API // -static GLXContext createLegacyContext(_GLFWwindow* window, - GLXFBConfig fbconfig, - GLXContext share) +static GLXContext createLegacyContextGLX(_GLFWwindow* window, + GLXFBConfig fbconfig, + GLXContext share) { return glXCreateNewContext(_glfw.x11.display, fbconfig, @@ -142,7 +142,7 @@ static GLXContext createLegacyContext(_GLFWwindow* window, True); } -static void makeContextCurrent(_GLFWwindow* window) +static void makeContextCurrentGLX(_GLFWwindow* window) { if (window) { @@ -168,12 +168,12 @@ static void makeContextCurrent(_GLFWwindow* window) _glfwPlatformSetCurrentContext(window); } -static void swapBuffers(_GLFWwindow* window) +static void swapBuffersGLX(_GLFWwindow* window) { glXSwapBuffers(_glfw.x11.display, window->context.glx.window); } -static void swapInterval(int interval) +static void swapIntervalGLX(int interval) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); @@ -192,7 +192,7 @@ static void swapInterval(int interval) } } -static int extensionSupported(const char* extension) +static int extensionSupportedGLX(const char* extension) { const char* extensions = glXQueryExtensionsString(_glfw.x11.display, _glfw.x11.screen); @@ -205,7 +205,7 @@ static int extensionSupported(const char* extension) return GLFW_FALSE; } -static GLFWglproc getProcAddress(const char* procname) +static GLFWglproc getProcAddressGLX(const char* procname) { if (_glfw.glx.GetProcAddress) return _glfw.glx.GetProcAddress((const GLubyte*) procname); @@ -217,7 +217,7 @@ static GLFWglproc getProcAddress(const char* procname) // Destroy the OpenGL context // -static void destroyContext(_GLFWwindow* window) +static void destroyContextGLX(_GLFWwindow* window) { if (window->context.glx.window) { @@ -319,61 +319,61 @@ GLFWbool _glfwInitGLX(void) return GLFW_FALSE; } - if (extensionSupported("GLX_EXT_swap_control")) + if (extensionSupportedGLX("GLX_EXT_swap_control")) { _glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC) - getProcAddress("glXSwapIntervalEXT"); + getProcAddressGLX("glXSwapIntervalEXT"); if (_glfw.glx.SwapIntervalEXT) _glfw.glx.EXT_swap_control = GLFW_TRUE; } - if (extensionSupported("GLX_SGI_swap_control")) + if (extensionSupportedGLX("GLX_SGI_swap_control")) { _glfw.glx.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC) - getProcAddress("glXSwapIntervalSGI"); + getProcAddressGLX("glXSwapIntervalSGI"); if (_glfw.glx.SwapIntervalSGI) _glfw.glx.SGI_swap_control = GLFW_TRUE; } - if (extensionSupported("GLX_MESA_swap_control")) + if (extensionSupportedGLX("GLX_MESA_swap_control")) { _glfw.glx.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC) - getProcAddress("glXSwapIntervalMESA"); + getProcAddressGLX("glXSwapIntervalMESA"); if (_glfw.glx.SwapIntervalMESA) _glfw.glx.MESA_swap_control = GLFW_TRUE; } - if (extensionSupported("GLX_ARB_multisample")) + if (extensionSupportedGLX("GLX_ARB_multisample")) _glfw.glx.ARB_multisample = GLFW_TRUE; - if (extensionSupported("GLX_ARB_framebuffer_sRGB")) + if (extensionSupportedGLX("GLX_ARB_framebuffer_sRGB")) _glfw.glx.ARB_framebuffer_sRGB = GLFW_TRUE; - if (extensionSupported("GLX_EXT_framebuffer_sRGB")) + if (extensionSupportedGLX("GLX_EXT_framebuffer_sRGB")) _glfw.glx.EXT_framebuffer_sRGB = GLFW_TRUE; - if (extensionSupported("GLX_ARB_create_context")) + if (extensionSupportedGLX("GLX_ARB_create_context")) { _glfw.glx.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC) - getProcAddress("glXCreateContextAttribsARB"); + getProcAddressGLX("glXCreateContextAttribsARB"); if (_glfw.glx.CreateContextAttribsARB) _glfw.glx.ARB_create_context = GLFW_TRUE; } - if (extensionSupported("GLX_ARB_create_context_robustness")) + if (extensionSupportedGLX("GLX_ARB_create_context_robustness")) _glfw.glx.ARB_create_context_robustness = GLFW_TRUE; - if (extensionSupported("GLX_ARB_create_context_profile")) + if (extensionSupportedGLX("GLX_ARB_create_context_profile")) _glfw.glx.ARB_create_context_profile = GLFW_TRUE; - if (extensionSupported("GLX_EXT_create_context_es2_profile")) + if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile")) _glfw.glx.EXT_create_context_es2_profile = GLFW_TRUE; - if (extensionSupported("GLX_ARB_context_flush_control")) + if (extensionSupportedGLX("GLX_ARB_context_flush_control")) _glfw.glx.ARB_context_flush_control = GLFW_TRUE; return GLFW_TRUE; @@ -413,7 +413,7 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, if (ctxconfig->share) share = ctxconfig->share->context.glx.handle; - if (!chooseFBConfig(fbconfig, &native)) + if (!chooseGLXFBConfig(fbconfig, &native)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "GLX: Failed to find a suitable GLXFBConfig"); @@ -549,12 +549,15 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, ctxconfig->forward == GLFW_FALSE) { window->context.glx.handle = - createLegacyContext(window, native, share); + createLegacyContextGLX(window, native, share); } } } else - window->context.glx.handle = createLegacyContext(window, native, share); + { + window->context.glx.handle = + createLegacyContextGLX(window, native, share); + } _glfwReleaseErrorHandlerX11(); @@ -572,12 +575,12 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window, return GLFW_FALSE; } - window->context.makeCurrent = makeContextCurrent; - window->context.swapBuffers = swapBuffers; - window->context.swapInterval = swapInterval; - window->context.extensionSupported = extensionSupported; - window->context.getProcAddress = getProcAddress; - window->context.destroy = destroyContext; + window->context.makeCurrent = makeContextCurrentGLX; + window->context.swapBuffers = swapBuffersGLX; + window->context.swapInterval = swapIntervalGLX; + window->context.extensionSupported = extensionSupportedGLX; + window->context.getProcAddress = getProcAddressGLX; + window->context.destroy = destroyContextGLX; return GLFW_TRUE; } @@ -593,7 +596,7 @@ GLFWbool _glfwChooseVisualGLX(const _GLFWctxconfig* ctxconfig, GLXFBConfig native; XVisualInfo* result; - if (!chooseFBConfig(fbconfig, &native)) + if (!chooseGLXFBConfig(fbconfig, &native)) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "GLX: Failed to find a suitable GLXFBConfig"); diff --git a/src/nsgl_context.m b/src/nsgl_context.m index 096ef9c4..64729009 100644 --- a/src/nsgl_context.m +++ b/src/nsgl_context.m @@ -27,7 +27,7 @@ #include "internal.h" -static void makeContextCurrent(_GLFWwindow* window) +static void makeContextCurrentNSGL(_GLFWwindow* window) { if (window) [window->context.nsgl.object makeCurrentContext]; @@ -37,13 +37,13 @@ static void makeContextCurrent(_GLFWwindow* window) _glfwPlatformSetCurrentContext(window); } -static void swapBuffers(_GLFWwindow* window) +static void swapBuffersNSGL(_GLFWwindow* window) { // ARP appears to be unnecessary, but this is future-proof [window->context.nsgl.object flushBuffer]; } -static void swapInterval(int interval) +static void swapIntervalNSGL(int interval) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); @@ -52,13 +52,13 @@ static void swapInterval(int interval) forParameter:NSOpenGLCPSwapInterval]; } -static int extensionSupported(const char* extension) +static int extensionSupportedNSGL(const char* extension) { // There are no NSGL extensions return GLFW_FALSE; } -static GLFWglproc getProcAddress(const char* procname) +static GLFWglproc getProcAddressNSGL(const char* procname) { CFStringRef symbolName = CFStringCreateWithCString(kCFAllocatorDefault, procname, @@ -74,7 +74,7 @@ static GLFWglproc getProcAddress(const char* procname) // Destroy the OpenGL context // -static void destroyContext(_GLFWwindow* window) +static void destroyContextNSGL(_GLFWwindow* window) { [window->context.nsgl.pixelFormat release]; window->context.nsgl.pixelFormat = nil; @@ -274,12 +274,12 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, [window->context.nsgl.object setView:window->ns.view]; - window->context.makeCurrent = makeContextCurrent; - window->context.swapBuffers = swapBuffers; - window->context.swapInterval = swapInterval; - window->context.extensionSupported = extensionSupported; - window->context.getProcAddress = getProcAddress; - window->context.destroy = destroyContext; + window->context.makeCurrent = makeContextCurrentNSGL; + window->context.swapBuffers = swapBuffersNSGL; + window->context.swapInterval = swapIntervalNSGL; + window->context.extensionSupported = extensionSupportedNSGL; + window->context.getProcAddress = getProcAddressNSGL; + window->context.destroy = destroyContextNSGL; return GLFW_TRUE; } diff --git a/src/wgl_context.c b/src/wgl_context.c index a318a317..27cf1b47 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -231,7 +231,7 @@ static GLFWbool isCompositionEnabled(void) return enabled; } -static void makeContextCurrent(_GLFWwindow* window) +static void makeContextCurrentWGL(_GLFWwindow* window) { if (window) { @@ -256,7 +256,7 @@ static void makeContextCurrent(_GLFWwindow* window) } } -static void swapBuffers(_GLFWwindow* window) +static void swapBuffersWGL(_GLFWwindow* window) { // HACK: Use DwmFlush when desktop composition is enabled if (isCompositionEnabled() && !window->monitor) @@ -269,7 +269,7 @@ static void swapBuffers(_GLFWwindow* window) SwapBuffers(window->context.wgl.dc); } -static void swapInterval(int interval) +static void swapIntervalWGL(int interval) { _GLFWwindow* window = _glfwPlatformGetCurrentContext(); @@ -284,7 +284,7 @@ static void swapInterval(int interval) _glfw.wgl.SwapIntervalEXT(interval); } -static int extensionSupported(const char* extension) +static int extensionSupportedWGL(const char* extension) { const char* extensions; @@ -313,7 +313,7 @@ static int extensionSupported(const char* extension) return GLFW_FALSE; } -static GLFWglproc getProcAddress(const char* procname) +static GLFWglproc getProcAddressWGL(const char* procname) { const GLFWglproc proc = (GLFWglproc) wglGetProcAddress(procname); if (proc) @@ -324,7 +324,7 @@ static GLFWglproc getProcAddress(const char* procname) // Destroy the OpenGL context // -static void destroyContext(_GLFWwindow* window) +static void destroyContextWGL(_GLFWwindow* window) { if (window->context.wgl.handle) { @@ -359,25 +359,25 @@ static void loadExtensions(void) // This needs to include every extension used below except for // WGL_ARB_extensions_string and WGL_EXT_extensions_string _glfw.wgl.ARB_multisample = - extensionSupported("WGL_ARB_multisample"); + extensionSupportedWGL("WGL_ARB_multisample"); _glfw.wgl.ARB_framebuffer_sRGB = - extensionSupported("WGL_ARB_framebuffer_sRGB"); + extensionSupportedWGL("WGL_ARB_framebuffer_sRGB"); _glfw.wgl.EXT_framebuffer_sRGB = - extensionSupported("WGL_EXT_framebuffer_sRGB"); + extensionSupportedWGL("WGL_EXT_framebuffer_sRGB"); _glfw.wgl.ARB_create_context = - extensionSupported("WGL_ARB_create_context"); + extensionSupportedWGL("WGL_ARB_create_context"); _glfw.wgl.ARB_create_context_profile = - extensionSupported("WGL_ARB_create_context_profile"); + extensionSupportedWGL("WGL_ARB_create_context_profile"); _glfw.wgl.EXT_create_context_es2_profile = - extensionSupported("WGL_EXT_create_context_es2_profile"); + extensionSupportedWGL("WGL_EXT_create_context_es2_profile"); _glfw.wgl.ARB_create_context_robustness = - extensionSupported("WGL_ARB_create_context_robustness"); + extensionSupportedWGL("WGL_ARB_create_context_robustness"); _glfw.wgl.EXT_swap_control = - extensionSupported("WGL_EXT_swap_control"); + extensionSupportedWGL("WGL_EXT_swap_control"); _glfw.wgl.ARB_pixel_format = - extensionSupported("WGL_ARB_pixel_format"); + extensionSupportedWGL("WGL_ARB_pixel_format"); _glfw.wgl.ARB_context_flush_control = - extensionSupported("WGL_ARB_context_flush_control"); + extensionSupportedWGL("WGL_ARB_context_flush_control"); _glfw.wgl.extensionsLoaded = GLFW_TRUE; } @@ -576,12 +576,12 @@ GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, } } - window->context.makeCurrent = makeContextCurrent; - window->context.swapBuffers = swapBuffers; - window->context.swapInterval = swapInterval; - window->context.extensionSupported = extensionSupported; - window->context.getProcAddress = getProcAddress; - window->context.destroy = destroyContext; + window->context.makeCurrent = makeContextCurrentWGL; + window->context.swapBuffers = swapBuffersWGL; + window->context.swapInterval = swapIntervalWGL; + window->context.extensionSupported = extensionSupportedWGL; + window->context.getProcAddress = getProcAddressWGL; + window->context.destroy = destroyContextWGL; return GLFW_TRUE; } @@ -599,7 +599,7 @@ int _glfwAnalyzeContextWGL(_GLFWwindow* window, if (_glfw.wgl.extensionsLoaded) return _GLFW_RECREATION_NOT_NEEDED; - makeContextCurrent(window); + makeContextCurrentWGL(window); loadExtensions(); if (ctxconfig->client == GLFW_OPENGL_API)