mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 00:30:57 +00:00
Added glfwDefaultWindowHints.
This commit is contained in:
+3
-3
@@ -121,9 +121,6 @@ GLFWAPI int glfwInit(void)
|
||||
|
||||
memset(&_glfwLibrary, 0, sizeof(_glfwLibrary));
|
||||
|
||||
// Not all window hints have zero as their default value
|
||||
_glfwSetDefaultWindowHints();
|
||||
|
||||
if (!_glfwPlatformInit())
|
||||
{
|
||||
_glfwPlatformTerminate();
|
||||
@@ -134,6 +131,9 @@ GLFWAPI int glfwInit(void)
|
||||
|
||||
_glfwInitialized = GL_TRUE;
|
||||
|
||||
// Not all window hints have zero as their default value
|
||||
glfwDefaultWindowHints();
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -350,9 +350,6 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
||||
// Error handling (init.c)
|
||||
void _glfwSetError(int error, const char* format, ...);
|
||||
|
||||
// Window management (window.c)
|
||||
void _glfwSetDefaultWindowHints(void);
|
||||
|
||||
// OpenGL context helpers (opengl.c)
|
||||
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
|
||||
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
|
||||
+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