mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Added glfwDefaultWindowHints.
This commit is contained in:
parent
bf43247aed
commit
5df4df6ca4
@ -529,6 +529,7 @@ GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp);
|
|||||||
GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp);
|
GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp);
|
||||||
|
|
||||||
/* Window handling */
|
/* Window handling */
|
||||||
|
GLFWAPI void glfwDefaultWindowHints(void);
|
||||||
GLFWAPI void glfwWindowHint(int target, int hint);
|
GLFWAPI void glfwWindowHint(int target, int hint);
|
||||||
GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, int mode, const char* title, GLFWwindow share);
|
GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, int mode, const char* title, GLFWwindow share);
|
||||||
GLFWAPI void glfwDestroyWindow(GLFWwindow window);
|
GLFWAPI void glfwDestroyWindow(GLFWwindow window);
|
||||||
|
@ -268,6 +268,7 @@ version of GLFW.</p>
|
|||||||
<h3>v3.0</h3>
|
<h3>v3.0</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Added <code>GLFWwindow</code> window handle type and updated window-related functions and callbacks to take a window handle</li>
|
<li>Added <code>GLFWwindow</code> window handle type and updated window-related functions and callbacks to take a window handle</li>
|
||||||
|
<li>Added <code>glfwDefaultWindowHints</code> function for resetting all window hints to their default values</li>
|
||||||
<li>Added <code>glfwMakeContextCurrent</code> function for making the context of the specified window current</li>
|
<li>Added <code>glfwMakeContextCurrent</code> function for making the context of the specified window current</li>
|
||||||
<li>Added <code>glfwGetError</code> and <code>glfwErrorString</code> error reporting functions and a number of error tokens</li>
|
<li>Added <code>glfwGetError</code> and <code>glfwErrorString</code> error reporting functions and a number of error tokens</li>
|
||||||
<li>Added <code>glfwSetErrorCallback</code> function and <code>GLFWerrorfun</code> type for receiving more specific and/or nested errors</li>
|
<li>Added <code>glfwSetErrorCallback</code> function and <code>GLFWerrorfun</code> type for receiving more specific and/or nested errors</li>
|
||||||
|
@ -121,9 +121,6 @@ GLFWAPI int glfwInit(void)
|
|||||||
|
|
||||||
memset(&_glfwLibrary, 0, sizeof(_glfwLibrary));
|
memset(&_glfwLibrary, 0, sizeof(_glfwLibrary));
|
||||||
|
|
||||||
// Not all window hints have zero as their default value
|
|
||||||
_glfwSetDefaultWindowHints();
|
|
||||||
|
|
||||||
if (!_glfwPlatformInit())
|
if (!_glfwPlatformInit())
|
||||||
{
|
{
|
||||||
_glfwPlatformTerminate();
|
_glfwPlatformTerminate();
|
||||||
@ -134,6 +131,9 @@ GLFWAPI int glfwInit(void)
|
|||||||
|
|
||||||
_glfwInitialized = GL_TRUE;
|
_glfwInitialized = GL_TRUE;
|
||||||
|
|
||||||
|
// Not all window hints have zero as their default value
|
||||||
|
glfwDefaultWindowHints();
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,9 +350,6 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
|
|||||||
// Error handling (init.c)
|
// Error handling (init.c)
|
||||||
void _glfwSetError(int error, const char* format, ...);
|
void _glfwSetError(int error, const char* format, ...);
|
||||||
|
|
||||||
// Window management (window.c)
|
|
||||||
void _glfwSetDefaultWindowHints(void);
|
|
||||||
|
|
||||||
// OpenGL context helpers (opengl.c)
|
// OpenGL context helpers (opengl.c)
|
||||||
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
|
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
|
||||||
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||||
|
61
src/window.c
61
src/window.c
@ -68,32 +68,6 @@ static void clearScrollOffsets(void)
|
|||||||
////// GLFW internal API //////
|
////// 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
|
// 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.glRobustness = _glfwLibrary.hints.glRobustness ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.share = (_GLFWwindow*) share;
|
wndconfig.share = (_GLFWwindow*) share;
|
||||||
|
|
||||||
// Reset to default values for the next call
|
|
||||||
_glfwSetDefaultWindowHints();
|
|
||||||
|
|
||||||
// Check the OpenGL bits of the window config
|
// Check the OpenGL bits of the window config
|
||||||
if (!_glfwIsValidContextConfig(&wndconfig))
|
if (!_glfwIsValidContextConfig(&wndconfig))
|
||||||
return GL_FALSE;
|
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
|
// Set hints for creating the window
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user