This commit is contained in:
Endre Kolláth 2015-06-03 17:02:53 +00:00
commit 9e2d6de3a6
4 changed files with 12 additions and 1 deletions

View File

@ -623,6 +623,7 @@ extern "C" {
#define GLFW_OPENGL_DEBUG_CONTEXT 0x00022007
#define GLFW_OPENGL_PROFILE 0x00022008
#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
#define GLFW_REUSE_CONTEXT 0x0002200A
#define GLFW_OPENGL_API 0x00030001
#define GLFW_OPENGL_ES_API 0x00030002

View File

@ -189,6 +189,7 @@ struct _GLFWctxconfig
int robustness;
int release;
_GLFWwindow* share;
int reuseContext;
};
@ -353,6 +354,7 @@ struct _GLFWlibrary
int profile;
int robustness;
int release;
int reuseContext;
} hints;
double cursorPosX, cursorPosY;

View File

@ -338,7 +338,11 @@ int _glfwCreateContext(_GLFWwindow* window,
return GL_FALSE;
}
if (window->wgl.ARB_create_context)
if (share && ctxconfig->reuseContext)
{
window->wgl.context = share;
}
else if (window->wgl.ARB_create_context)
{
int index = 0, mask = 0, flags = 0;

View File

@ -171,6 +171,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
ctxconfig.robustness = _glfw.hints.robustness;
ctxconfig.release = _glfw.hints.release;
ctxconfig.share = (_GLFWwindow*) share;
ctxconfig.reuseContext = _glfw.hints.reuseContext;
// Check the OpenGL bits of the window config
if (!_glfwIsValidContextConfig(&ctxconfig))
@ -295,6 +296,7 @@ void glfwDefaultWindowHints(void)
_glfw.hints.depthBits = 24;
_glfw.hints.stencilBits = 8;
_glfw.hints.doublebuffer = GL_TRUE;
_glfw.hints.reuseContext = GL_FALSE;
}
GLFWAPI void glfwWindowHint(int target, int hint)
@ -393,6 +395,8 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_CONTEXT_RELEASE_BEHAVIOR:
_glfw.hints.release = hint;
break;
case GLFW_REUSE_CONTEXT:
_glfw.hints.reuseContext = hint;
default:
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint");
break;