Added glfwDefaultWindowHints.

This commit is contained in:
Camilla Berglund
2012-10-22 02:59:05 +02:00
parent bf43247aed
commit 5df4df6ca4
5 changed files with 37 additions and 35 deletions
+32 -29
View File
@@ -68,32 +68,6 @@ static void clearScrollOffsets(void)
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
//========================================================================
// Reset all window hints to their default values
//========================================================================
void _glfwSetDefaultWindowHints(void)
{
memset(&_glfwLibrary.hints, 0, sizeof(_glfwLibrary.hints));
// The default is OpenGL with minimum version 1.0
_glfwLibrary.hints.clientAPI = GLFW_OPENGL_API;
_glfwLibrary.hints.glMajor = 1;
_glfwLibrary.hints.glMinor = 0;
// The default is to show the window and allow window resizing
_glfwLibrary.hints.resizable = GL_TRUE;
_glfwLibrary.hints.visible = GL_TRUE;
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil
_glfwLibrary.hints.redBits = 8;
_glfwLibrary.hints.greenBits = 8;
_glfwLibrary.hints.blueBits = 8;
_glfwLibrary.hints.depthBits = 24;
_glfwLibrary.hints.stencilBits = 8;
}
//========================================================================
// Register window focus events
//========================================================================
@@ -273,9 +247,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
wndconfig.glRobustness = _glfwLibrary.hints.glRobustness ? GL_TRUE : GL_FALSE;
wndconfig.share = (_GLFWwindow*) share;
// Reset to default values for the next call
_glfwSetDefaultWindowHints();
// Check the OpenGL bits of the window config
if (!_glfwIsValidContextConfig(&wndconfig))
return GL_FALSE;
@@ -375,6 +346,38 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
}
//========================================================================
// Reset all window hints to their default values
//========================================================================
void glfwDefaultWindowHints(void)
{
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
memset(&_glfwLibrary.hints, 0, sizeof(_glfwLibrary.hints));
// The default is OpenGL with minimum version 1.0
_glfwLibrary.hints.clientAPI = GLFW_OPENGL_API;
_glfwLibrary.hints.glMajor = 1;
_glfwLibrary.hints.glMinor = 0;
// The default is to show the window and allow window resizing
_glfwLibrary.hints.resizable = GL_TRUE;
_glfwLibrary.hints.visible = GL_TRUE;
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil
_glfwLibrary.hints.redBits = 8;
_glfwLibrary.hints.greenBits = 8;
_glfwLibrary.hints.blueBits = 8;
_glfwLibrary.hints.depthBits = 24;
_glfwLibrary.hints.stencilBits = 8;
}
//========================================================================
// Set hints for creating the window
//========================================================================