mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 00:30:57 +00:00
Added glfwDefaultWindowHints.
This commit is contained in:
+32
-29
@@ -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
|
||||
//========================================================================
|
||||
|
||||
Reference in New Issue
Block a user