mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 06:14:35 +00:00
Added glfwCopyGLState.
This commit is contained in:
parent
6fa2730087
commit
8aa8b7c2e4
@ -583,6 +583,7 @@ GLFWAPI void glfwSwapInterval(int interval);
|
||||
GLFWAPI int glfwExtensionSupported(const char* extension);
|
||||
GLFWAPI void* glfwGetProcAddress(const char* procname);
|
||||
GLFWAPI void glfwGetGLVersion(int* major, int* minor, int* rev);
|
||||
GLFWAPI void glfwCopyGLState(GLFWwindow src, GLFWwindow dst, unsigned long mask);
|
||||
|
||||
/* Enable/disable functions */
|
||||
GLFWAPI void glfwEnable(GLFWwindow window, int token);
|
||||
|
@ -273,6 +273,7 @@ version of GLFW.</p>
|
||||
<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>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>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>windows</code> simple multi-window test program</li>
|
||||
|
@ -86,3 +86,12 @@ void* _glfwPlatformGetProcAddress(const char* procname)
|
||||
return symbol;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// Copies the specified OpenGL state categories from src to dst
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
||||
{
|
||||
[dst->NSGL.context copyAttributesFromContext:src->NSGL.context withMask:mask];
|
||||
}
|
||||
|
||||
|
@ -310,6 +310,7 @@ void _glfwPlatformSwapInterval(int interval);
|
||||
void _glfwPlatformRefreshWindowParams(void);
|
||||
int _glfwPlatformExtensionSupported(const char* extension);
|
||||
void* _glfwPlatformGetProcAddress(const char* procname);
|
||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask);
|
||||
|
||||
|
||||
//========================================================================
|
||||
|
22
src/opengl.c
22
src/opengl.c
@ -587,3 +587,25 @@ GLFWAPI void glfwGetGLVersion(int* major, int* minor, int* rev)
|
||||
*rev = window->glRevision;
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Copies the specified OpenGL state categories from src to dst
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI void glfwCopyGLState(GLFWwindow hsrc, GLFWwindow hdst, unsigned long mask)
|
||||
{
|
||||
_GLFWwindow* src;
|
||||
_GLFWwindow* dst;
|
||||
|
||||
if (!_glfwInitialized)
|
||||
{
|
||||
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
src = (_GLFWwindow*) hsrc;
|
||||
dst = (_GLFWwindow*) hdst;
|
||||
|
||||
_glfwPlatformCopyGLState(src, dst, mask);
|
||||
}
|
||||
|
||||
|
@ -103,3 +103,14 @@ void* _glfwPlatformGetProcAddress(const char* procname)
|
||||
return (void*) wglGetProcAddress(procname);
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Copies the specified OpenGL state categories from src to dst
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
||||
{
|
||||
if (!wglCopyContext(src->WGL.context, dst->WGL.context, mask))
|
||||
_glfwSetError(GLFW_PLATFORM_ERROR, "Win32/WGL: Failed to copy OpenGL context attributes");
|
||||
}
|
||||
|
||||
|
@ -116,3 +116,16 @@ void* _glfwPlatformGetProcAddress(const char* procname)
|
||||
return (void*) _glfw_glXGetProcAddress((const GLubyte*) procname);
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Copies the specified OpenGL state categories from src to dst
|
||||
//========================================================================
|
||||
|
||||
void _glfwPlatformCopyGLState(_GLFWwindow* src, _GLFWwindow* dst, unsigned long mask)
|
||||
{
|
||||
glXCopyContext(_glfwLibrary.X11.display,
|
||||
src->GLX.context,
|
||||
dst->GLX.context,
|
||||
mask);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user