mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Renamed context-related functions to more closely match underlying APIs.
This commit is contained in:
parent
7268fc18b4
commit
c1ab73b979
@ -537,9 +537,7 @@ GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp);
|
|||||||
/* Window handling */
|
/* Window handling */
|
||||||
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int mode, const char* title, GLFWwindow share);
|
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int mode, const char* title, GLFWwindow share);
|
||||||
GLFWAPI void glfwOpenWindowHint(int target, int hint);
|
GLFWAPI void glfwOpenWindowHint(int target, int hint);
|
||||||
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window);
|
|
||||||
GLFWAPI int glfwIsWindow(GLFWwindow window);
|
GLFWAPI int glfwIsWindow(GLFWwindow window);
|
||||||
GLFWAPI GLFWwindow glfwGetCurrentWindow(void);
|
|
||||||
GLFWAPI void glfwCloseWindow(GLFWwindow window);
|
GLFWAPI void glfwCloseWindow(GLFWwindow window);
|
||||||
GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title);
|
GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title);
|
||||||
GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height);
|
GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height);
|
||||||
@ -583,11 +581,13 @@ GLFWAPI double glfwGetTime(void);
|
|||||||
GLFWAPI void glfwSetTime(double time);
|
GLFWAPI void glfwSetTime(double time);
|
||||||
|
|
||||||
/* OpenGL support */
|
/* OpenGL support */
|
||||||
|
GLFWAPI void glfwMakeContextCurrent(GLFWwindow window);
|
||||||
|
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 void* glfwGetProcAddress(const char* procname);
|
||||||
GLFWAPI void glfwCopyGLState(GLFWwindow src, GLFWwindow dst, unsigned long mask);
|
GLFWAPI void glfwCopyContext(GLFWwindow src, GLFWwindow dst, unsigned long mask);
|
||||||
|
|
||||||
/* Enable/disable functions */
|
/* Enable/disable functions */
|
||||||
GLFWAPI void glfwEnable(GLFWwindow window, int token);
|
GLFWAPI void glfwEnable(GLFWwindow window, int token);
|
||||||
|
@ -263,7 +263,7 @@ version of GLFW.</p>
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Added <code>GLFWwindow</code> window handle type and updated window-related functions and callbacks to take a window handle</li>
|
<li>Added <code>GLFWwindow</code> window handle type and updated window-related functions and callbacks to take a window handle</li>
|
||||||
<li>Added <code>glfwIsWindow</code> function for verifying that a given window handle is (still) valid</li>
|
<li>Added <code>glfwIsWindow</code> function for verifying that a given window handle is (still) valid</li>
|
||||||
<li>Added <code>glfwMakeWindowCurrent</code> function for making the context of the specified window current</li>
|
<li>Added <code>glfwMakeContextCurrent</code> function for making the context of the specified window current</li>
|
||||||
<li>Added <code>glfwGetError</code> and <code>glfwErrorString</code> error reporting functions and a number of error tokens</li>
|
<li>Added <code>glfwGetError</code> and <code>glfwErrorString</code> error reporting functions and a number of error tokens</li>
|
||||||
<li>Added <code>glfwSetErrorCallback</code> function and <code>GLFWerrorfun</code> type for receiving more specific and/or nested errors</li>
|
<li>Added <code>glfwSetErrorCallback</code> function and <code>GLFWerrorfun</code> type for receiving more specific and/or nested errors</li>
|
||||||
<li>Added <code>glfwSetWindowUserPointer</code> and <code>glfwGetWindowUserPointer</code> functions for per-window user pointers</li>
|
<li>Added <code>glfwSetWindowUserPointer</code> and <code>glfwGetWindowUserPointer</code> functions for per-window user pointers</li>
|
||||||
@ -271,9 +271,9 @@ version of GLFW.</p>
|
|||||||
<li>Added <code>glfwGetWindowPos</code> function for querying the position of the specified window</li>
|
<li>Added <code>glfwGetWindowPos</code> function for querying the position of the specified window</li>
|
||||||
<li>Added <code>glfwSetWindowFocusCallback</code> function and <code>GLFWwindowfocusfun</code> type for receiving window focus events</li>
|
<li>Added <code>glfwSetWindowFocusCallback</code> function and <code>GLFWwindowfocusfun</code> type for receiving window focus events</li>
|
||||||
<li>Added <code>glfwSetWindowIconifyCallback</code> function and <code>GLFWwindowiconifyfun</code> type for receiving window iconification events</li>
|
<li>Added <code>glfwSetWindowIconifyCallback</code> function and <code>GLFWwindowiconifyfun</code> type for receiving window iconification events</li>
|
||||||
<li>Added <code>glfwGetCurrentWindow</code> function for retrieving the window whose OpenGL context is current</li>
|
<li>Added <code>glfwGetCurrentContext</code> function for retrieving the window whose OpenGL context is current</li>
|
||||||
<li>Added <code>glfwInitWithModels</code> function and <code>GLFWallocator</code> and <code>GLFWthreadmodel</code> types for pluggable memory allocation and threading models</li>
|
<li>Added <code>glfwInitWithModels</code> function and <code>GLFWallocator</code> and <code>GLFWthreadmodel</code> types for pluggable memory allocation and threading models</li>
|
||||||
<li>Added <code>glfwCopyGLState</code> function for copying OpenGL state categories between contexts</li>
|
<li>Added <code>glfwCopyContext</code> function for copying OpenGL state categories between contexts</li>
|
||||||
<li>Added <code>GLFW_OPENGL_ES2_PROFILE</code> profile for creating OpenGL ES 2.0 contexts using the <code>GLX_EXT_create_context_es2_profile</code> and <code>WGL_EXT_create_context_es2_profile</code> extensions</li>
|
<li>Added <code>GLFW_OPENGL_ES2_PROFILE</code> profile for creating OpenGL ES 2.0 contexts using the <code>GLX_EXT_create_context_es2_profile</code> and <code>WGL_EXT_create_context_es2_profile</code> extensions</li>
|
||||||
<li>Added <code>GLFW_OPENGL_ROBUSTNESS</code> window hint and associated strategy tokens for <code>GL_ARB_robustness</code> support</li>
|
<li>Added <code>GLFW_OPENGL_ROBUSTNESS</code> window hint and associated strategy tokens for <code>GL_ARB_robustness</code> support</li>
|
||||||
<li>Added <code>GLFW_OPENGL_REVISION</code> window parameter to make up for removal of <code>glfwGetGLVersion</code></li>
|
<li>Added <code>GLFW_OPENGL_REVISION</code> window parameter to make up for removal of <code>glfwGetGLVersion</code></li>
|
||||||
|
@ -34,6 +34,19 @@
|
|||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Make the OpenGL context associated with the specified window current
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
[window->NSGL.context makeCurrentContext];
|
||||||
|
else
|
||||||
|
[NSOpenGLContext clearCurrentContext];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Swap buffers
|
// Swap buffers
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -90,7 +103,7 @@ void* _glfwPlatformGetProcAddress(const char* procname)
|
|||||||
// Copies the specified OpenGL state categories from src to dst
|
// Copies the specified OpenGL state categories from src to dst
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
||||||
{
|
{
|
||||||
[dst->NSGL.context copyAttributesFromContext:src->NSGL.context withMask:mask];
|
[dst->NSGL.context copyAttributesFromContext:src->NSGL.context withMask:mask];
|
||||||
}
|
}
|
||||||
|
@ -675,7 +675,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
withOptions:nil];
|
withOptions:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
glfwMakeWindowCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
NSPoint point = [[NSCursor currentCursor] hotSpot];
|
NSPoint point = [[NSCursor currentCursor] hotSpot];
|
||||||
window->mousePosX = point.x;
|
window->mousePosX = point.x;
|
||||||
@ -686,18 +686,6 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Make the OpenGL context associated with the specified window current
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
void _glfwPlatformMakeWindowCurrent(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
if (window)
|
|
||||||
[window->NSGL.context makeCurrentContext];
|
|
||||||
else
|
|
||||||
[NSOpenGLContext clearCurrentContext];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Properly kill the window / video display
|
// Properly kill the window / video display
|
||||||
|
@ -296,7 +296,6 @@ void _glfwPlatformSetTime(double time);
|
|||||||
|
|
||||||
// Window management
|
// Window management
|
||||||
int _glfwPlatformOpenWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig);
|
int _glfwPlatformOpenWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig);
|
||||||
void _glfwPlatformMakeWindowCurrent(_GLFWwindow* window);
|
|
||||||
void _glfwPlatformCloseWindow(_GLFWwindow* window);
|
void _glfwPlatformCloseWindow(_GLFWwindow* window);
|
||||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
|
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
|
||||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
|
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
|
||||||
@ -312,12 +311,13 @@ void _glfwPlatformPollEvents(void);
|
|||||||
void _glfwPlatformWaitEvents(void);
|
void _glfwPlatformWaitEvents(void);
|
||||||
|
|
||||||
// OpenGL context management
|
// OpenGL context management
|
||||||
|
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window);
|
||||||
void _glfwPlatformSwapBuffers(void);
|
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);
|
void* _glfwPlatformGetProcAddress(const char* procname);
|
||||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask);
|
void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask);
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
42
src/opengl.c
42
src/opengl.c
@ -423,6 +423,44 @@ int _glfwStringInExtensionString(const char* string,
|
|||||||
////// GLFW public API //////
|
////// GLFW public API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Make the OpenGL context associated with the specified window current
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
GLFWAPI void glfwMakeContextCurrent(GLFWwindow handle)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||||
|
|
||||||
|
if (!_glfwInitialized)
|
||||||
|
{
|
||||||
|
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_glfwLibrary.currentWindow == window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_glfwPlatformMakeContextCurrent(window);
|
||||||
|
_glfwLibrary.currentWindow = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Returns the window whose OpenGL context is current
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
GLFWAPI GLFWwindow glfwGetCurrentContext(void)
|
||||||
|
{
|
||||||
|
if (!_glfwInitialized)
|
||||||
|
{
|
||||||
|
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _glfwLibrary.currentWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Swap buffers (double-buffering)
|
// Swap buffers (double-buffering)
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -560,7 +598,7 @@ GLFWAPI void* glfwGetProcAddress(const char* procname)
|
|||||||
// Copies the specified OpenGL state categories from src to dst
|
// Copies the specified OpenGL state categories from src to dst
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwCopyGLState(GLFWwindow hsrc, GLFWwindow hdst, unsigned long mask)
|
GLFWAPI void glfwCopyContext(GLFWwindow hsrc, GLFWwindow hdst, unsigned long mask)
|
||||||
{
|
{
|
||||||
_GLFWwindow* src;
|
_GLFWwindow* src;
|
||||||
_GLFWwindow* dst;
|
_GLFWwindow* dst;
|
||||||
@ -580,6 +618,6 @@ GLFWAPI void glfwCopyGLState(GLFWwindow hsrc, GLFWwindow hdst, unsigned long mas
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformCopyGLState(src, dst, mask);
|
_glfwPlatformCopyContext(src, dst, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,19 @@
|
|||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Make the OpenGL context associated with the specified window current
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
wglMakeCurrent(window->WGL.DC, window->WGL.context);
|
||||||
|
else
|
||||||
|
wglMakeCurrent(NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Swap buffers (double-buffering)
|
// Swap buffers (double-buffering)
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -108,7 +121,7 @@ void* _glfwPlatformGetProcAddress(const char* procname)
|
|||||||
// Copies the specified OpenGL state categories from src to dst
|
// Copies the specified OpenGL state categories from src to dst
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
||||||
{
|
{
|
||||||
if (!wglCopyContext(src->WGL.context, dst->WGL.context, mask))
|
if (!wglCopyContext(src->WGL.context, dst->WGL.context, mask))
|
||||||
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to copy OpenGL context attributes");
|
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to copy OpenGL context attributes");
|
||||||
|
@ -1342,7 +1342,7 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
if (!createContext(window, wndconfig, pixelFormat))
|
if (!createContext(window, wndconfig, pixelFormat))
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
glfwMakeWindowCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
initWGLExtensions(window);
|
initWGLExtensions(window);
|
||||||
|
|
||||||
@ -1365,7 +1365,7 @@ static void destroyWindow(_GLFWwindow* window)
|
|||||||
// This is duplicated from glfwCloseWindow
|
// This is duplicated from glfwCloseWindow
|
||||||
// TODO: Stop duplicating code
|
// TODO: Stop duplicating code
|
||||||
if (window == _glfwLibrary.currentWindow)
|
if (window == _glfwLibrary.currentWindow)
|
||||||
glfwMakeWindowCurrent(NULL);
|
glfwMakeContextCurrent(NULL);
|
||||||
|
|
||||||
// This is duplicated from glfwCloseWindow
|
// This is duplicated from glfwCloseWindow
|
||||||
// TODO: Stop duplicating code
|
// TODO: Stop duplicating code
|
||||||
@ -1521,19 +1521,6 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Make the OpenGL context associated with the specified window current
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
void _glfwPlatformMakeWindowCurrent(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
if (window)
|
|
||||||
wglMakeCurrent(window->WGL.DC, window->WGL.context);
|
|
||||||
else
|
|
||||||
wglMakeCurrent(NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Properly kill the window / video display
|
// Properly kill the window / video display
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
42
src/window.c
42
src/window.c
@ -336,7 +336,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cache the actual (as opposed to desired) window parameters
|
// Cache the actual (as opposed to desired) window parameters
|
||||||
glfwMakeWindowCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
_glfwPlatformRefreshWindowParams();
|
_glfwPlatformRefreshWindowParams();
|
||||||
|
|
||||||
if (!_glfwIsValidContext(window, &wndconfig))
|
if (!_glfwIsValidContext(window, &wndconfig))
|
||||||
@ -359,28 +359,6 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Make the OpenGL context associated with the specified window current
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow handle)
|
|
||||||
{
|
|
||||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
|
||||||
|
|
||||||
if (!_glfwInitialized)
|
|
||||||
{
|
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_glfwLibrary.currentWindow == window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_glfwPlatformMakeWindowCurrent(window);
|
|
||||||
_glfwLibrary.currentWindow = window;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Returns GL_TRUE if the specified window handle is an actual window
|
// Returns GL_TRUE if the specified window handle is an actual window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -409,22 +387,6 @@ GLFWAPI int glfwIsWindow(GLFWwindow handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Returns GL_TRUE if the specified window handle is an actual window
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
GLFWAPI GLFWwindow glfwGetCurrentWindow(void)
|
|
||||||
{
|
|
||||||
if (!_glfwInitialized)
|
|
||||||
{
|
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _glfwLibrary.currentWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Set hints for opening the window
|
// Set hints for opening the window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -532,7 +494,7 @@ GLFWAPI void glfwCloseWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
// Clear the current context if this window's context is current
|
// Clear the current context if this window's context is current
|
||||||
if (window == _glfwLibrary.currentWindow)
|
if (window == _glfwLibrary.currentWindow)
|
||||||
glfwMakeWindowCurrent(NULL);
|
glfwMakeContextCurrent(NULL);
|
||||||
|
|
||||||
// Clear the active window pointer if this is the active window
|
// Clear the active window pointer if this is the active window
|
||||||
if (window == _glfwLibrary.activeWindow)
|
if (window == _glfwLibrary.activeWindow)
|
||||||
|
@ -56,6 +56,23 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
|
|||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Make the OpenGL context associated with the specified window current
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
glXMakeCurrent(_glfwLibrary.X11.display,
|
||||||
|
window->X11.handle,
|
||||||
|
window->GLX.context);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
glXMakeCurrent(_glfwLibrary.X11.display, None, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Swap OpenGL buffers
|
// Swap OpenGL buffers
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -121,7 +138,7 @@ void* _glfwPlatformGetProcAddress(const char* procname)
|
|||||||
// Copies the specified OpenGL state categories from src to dst
|
// Copies the specified OpenGL state categories from src to dst
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
void _glfwPlatformCopyContext(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
||||||
{
|
{
|
||||||
glXCopyContext(_glfwLibrary.X11.display,
|
glXCopyContext(_glfwLibrary.X11.display,
|
||||||
src->GLX.context,
|
src->GLX.context,
|
||||||
|
@ -1448,23 +1448,6 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// Make the OpenGL context associated with the specified window current
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
void _glfwPlatformMakeWindowCurrent(_GLFWwindow* window)
|
|
||||||
{
|
|
||||||
if (window)
|
|
||||||
{
|
|
||||||
glXMakeCurrent(_glfwLibrary.X11.display,
|
|
||||||
window->X11.handle,
|
|
||||||
window->GLX.context);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
glXMakeCurrent(_glfwLibrary.X11.display, None, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
// Properly kill the window/video display
|
// Properly kill the window/video display
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
@ -80,7 +80,7 @@ static GLuint create_texture(void)
|
|||||||
static void draw_quad(GLuint texture)
|
static void draw_quad(GLuint texture)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
glfwGetWindowSize(glfwGetCurrentWindow(), &width, &height);
|
glfwGetWindowSize(glfwGetCurrentContext(), &width, &height);
|
||||||
|
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
|
||||||
@ -148,11 +148,11 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
while (glfwIsWindow(windows[0]) && glfwIsWindow(windows[1]))
|
while (glfwIsWindow(windows[0]) && glfwIsWindow(windows[1]))
|
||||||
{
|
{
|
||||||
glfwMakeWindowCurrent(windows[0]);
|
glfwMakeContextCurrent(windows[0]);
|
||||||
draw_quad(texture);
|
draw_quad(texture);
|
||||||
glfwSwapBuffers();
|
glfwSwapBuffers();
|
||||||
|
|
||||||
glfwMakeWindowCurrent(windows[1]);
|
glfwMakeContextCurrent(windows[1]);
|
||||||
draw_quad(texture);
|
draw_quad(texture);
|
||||||
glfwSwapBuffers();
|
glfwSwapBuffers();
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
glfwMakeWindowCurrent(windows[i]);
|
glfwMakeContextCurrent(windows[i]);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glfwSwapBuffers();
|
glfwSwapBuffers();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user