Renamed window creation/destruction functions.

Renamed glfwOpenWindow to glfwCreateWindow.
Renamed glfwCloseWindow to glfwDestroyWindow.
Renamed glfwOpenWindowHint to glfwWindowHint.
This commit is contained in:
Camilla Berglund 2012-08-06 17:56:41 +02:00
parent 13ff3eeca9
commit aff30d0baa
35 changed files with 109 additions and 109 deletions

View File

@ -587,9 +587,9 @@ int main( void )
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16); glfwWindowHint(GLFW_DEPTH_BITS, 16);
window = glfwOpenWindow( 400, 400, GLFW_WINDOWED, "Boing (classic Amiga demo)", NULL ); window = glfwCreateWindow( 400, 400, GLFW_WINDOWED, "Boing (classic Amiga demo)", NULL );
if (!window) if (!window)
{ {
fprintf( stderr, "Failed to open GLFW window\n" ); fprintf( stderr, "Failed to open GLFW window\n" );

View File

@ -337,9 +337,9 @@ int main(int argc, char *argv[])
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16); glfwWindowHint(GLFW_DEPTH_BITS, 16);
window = glfwOpenWindow( 300, 300, GLFW_WINDOWED, "Gears", NULL ); window = glfwCreateWindow( 300, 300, GLFW_WINDOWED, "Gears", NULL );
if (!window) if (!window)
{ {
fprintf( stderr, "Failed to open GLFW window\n" ); fprintf( stderr, "Failed to open GLFW window\n" );

View File

@ -581,13 +581,13 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
glfwOpenWindowHint(GLFW_WINDOW_RESIZABLE, GL_FALSE); glfwWindowHint(GLFW_WINDOW_RESIZABLE, GL_FALSE);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); glfwWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);
window = glfwOpenWindow(800, 600, GLFW_WINDOWED, "GLFW OpenGL3 Heightmap demo", NULL); window = glfwCreateWindow(800, 600, GLFW_WINDOWED, "GLFW OpenGL3 Heightmap demo", NULL);
if (! window ) if (! window )
{ {
fprintf(stderr, "ERROR: Unable to create the OpenGL context and associated window\n"); fprintf(stderr, "ERROR: Unable to create the OpenGL context and associated window\n");

View File

@ -1028,7 +1028,7 @@ int main( int argc, char **argv )
} }
// Open OpenGL fullscreen window // Open OpenGL fullscreen window
if( !glfwOpenWindow( WIDTH, HEIGHT, 0,0,0,0, 16,0, GLFW_FULLSCREEN ) ) if( !glfwCreateWindow( WIDTH, HEIGHT, 0,0,0,0, 16,0, GLFW_FULLSCREEN ) )
{ {
fprintf( stderr, "Failed to open GLFW window\n" ); fprintf( stderr, "Failed to open GLFW window\n" );
glfwTerminate(); glfwTerminate();

View File

@ -810,7 +810,7 @@ int main( void )
} }
// Open OpenGL window // Open OpenGL window
if( !glfwOpenWindow( WIDTH, HEIGHT, 0,0,0,0, 16,0, GLFW_FULLSCREEN ) ) if( !glfwCreateWindow( WIDTH, HEIGHT, 0,0,0,0, 16,0, GLFW_FULLSCREEN ) )
{ {
fprintf( stderr, "Failed to open GLFW window\n" ); fprintf( stderr, "Failed to open GLFW window\n" );
glfwTerminate(); glfwTerminate();

View File

@ -464,10 +464,10 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16); glfwWindowHint(GLFW_DEPTH_BITS, 16);
// Open OpenGL window // Open OpenGL window
window = glfwOpenWindow(500, 500, GLFW_WINDOWED, "Split view demo", NULL); window = glfwCreateWindow(500, 500, GLFW_WINDOWED, "Split view demo", NULL);
if (!window) if (!window)
{ {
fprintf(stderr, "Failed to open GLFW window\n"); fprintf(stderr, "Failed to open GLFW window\n");

View File

@ -31,7 +31,7 @@ int main(void)
} }
// Open a window and create its OpenGL context // Open a window and create its OpenGL context
window = glfwOpenWindow(640, 480, GLFW_WINDOWED, "Spinning Triangle", NULL); window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Spinning Triangle", NULL);
if (!window) if (!window)
{ {
fprintf(stderr, "Failed to open GLFW window\n"); fprintf(stderr, "Failed to open GLFW window\n");

View File

@ -398,7 +398,7 @@ int main(int argc, char* argv[])
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(640, 480, GLFW_WINDOWED, "Wave Simulation", NULL); window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Wave Simulation", NULL);
if (!window) if (!window)
{ {
fprintf(stderr, "Could not open window\n"); fprintf(stderr, "Could not open window\n");

View File

@ -381,7 +381,7 @@ extern "C" {
* Other definitions * Other definitions
*************************************************************************/ *************************************************************************/
/* glfwOpenWindow modes */ /* glfwCreateWindow modes */
#define GLFW_WINDOWED 0x00010001 #define GLFW_WINDOWED 0x00010001
#define GLFW_FULLSCREEN 0x00010002 #define GLFW_FULLSCREEN 0x00010002
@ -391,7 +391,7 @@ extern "C" {
#define GLFW_OPENGL_REVISION 0x00020004 #define GLFW_OPENGL_REVISION 0x00020004
/* The following constants are used for both glfwGetWindowParam /* The following constants are used for both glfwGetWindowParam
* and glfwOpenWindowHint * and glfwWindowHint
*/ */
#define GLFW_RED_BITS 0x00021000 #define GLFW_RED_BITS 0x00021000
#define GLFW_GREEN_BITS 0x00021001 #define GLFW_GREEN_BITS 0x00021001
@ -527,9 +527,9 @@ GLFWAPI void glfwGetGammaRamp(GLFWgammaramp* ramp);
GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp); GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp);
/* Window handling */ /* Window handling */
GLFWAPI GLFWwindow glfwOpenWindow(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 glfwOpenWindowHint(int target, int hint); GLFWAPI void glfwWindowHint(int target, int hint);
GLFWAPI void glfwCloseWindow(GLFWwindow window); GLFWAPI void glfwDestroyWindow(GLFWwindow window);
GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title); GLFWAPI void glfwSetWindowTitle(GLFWwindow, const char* title);
GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height); GLFWAPI void glfwGetWindowSize(GLFWwindow, int* width, int* height);
GLFWAPI void glfwSetWindowSize(GLFWwindow, int width, int height); GLFWAPI void glfwSetWindowSize(GLFWwindow, int width, int height);

View File

@ -287,20 +287,20 @@ version of GLFW.</p>
<li>Added <code>sharing</code> simple OpenGL object sharing test program</li> <li>Added <code>sharing</code> simple OpenGL object sharing test program</li>
<li>Added <code>modes</code> video mode enumeration and setting test program</li> <li>Added <code>modes</code> video mode enumeration and setting test program</li>
<li>Added <code>glfw3native.h</code> header and platform-specific functions for explicit access to native display, window and context handles</li> <li>Added <code>glfw3native.h</code> header and platform-specific functions for explicit access to native display, window and context handles</li>
<li>Added a parameter to <code>glfwOpenWindow</code> for specifying a context the new window's context will share objects with</li>
<li>Added initial window title parameter to <code>glfwOpenWindow</code></li>
<li>Added <code>glfwSetGamma</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li> <li>Added <code>glfwSetGamma</code>, <code>glfwSetGammaRamp</code> and <code>glfwGetGammaRamp</code> functions and <code>GLFWgammaramp</code> type for monitor gamma ramp control</li>
<li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li> <li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li>
<li>Changed <code>glfwOpenWindow</code> and <code>glfwSetWindowTitle</code> to use UTF-8 encoded strings</li> <li>Changed <code>glfwOpenWindow</code> and <code>glfwSetWindowTitle</code> to use UTF-8 encoded strings</li>
<li>Changed <code>glfwGetProcAddress</code> to return a (generic) function pointer</li> <li>Changed <code>glfwGetProcAddress</code> to return a (generic) function pointer</li>
<li>Changed <code>glfwGetVideoModes</code> to return a dynamic, unlimited number of video modes</li> <li>Changed <code>glfwGetVideoModes</code> to return a dynamic, unlimited number of video modes</li>
<li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li> <li>Renamed <code>glfw.h</code> to <code>glfw3.h</code> to avoid conflicts with 2.x series</li>
<li>Renamed <code>glfwOpenWindowHint</code> to <code>glfwWindowHint</code></li>
<li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li> <li>Renamed <code>GLFW_WINDOW</code> token to <code>GLFW_WINDOWED</code></li>
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_WINDOW_RESIZABLE</code></li> <li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_WINDOW_RESIZABLE</code></li>
<li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li> <li>Renamed <code>GLFW_BUILD_DLL</code> to <code>_GLFW_BUILD_DLL</code></li>
<li>Renamed <code>version</code> test to <code>glfwinfo</code></li> <li>Renamed <code>version</code> test to <code>glfwinfo</code></li>
<li>Renamed <code>GLFW_NO_GLU</code> to <code>GLFW_INCLUDE_GLU</code> and made it disabled by default</li> <li>Renamed <code>GLFW_NO_GLU</code> to <code>GLFW_INCLUDE_GLU</code> and made it disabled by default</li>
<li>Renamed mouse position functions to cursor position equivalents</li> <li>Renamed mouse position functions to cursor position equivalents</li>
<li>Replaced <code>glfwOpenWindow</code> and <code>glfwCloseWindow</code> with <code>glfwCreateWindow</code> and <code>glfwDestroyWindow</code></li>
<li>Replaced ad hoc build system with CMake</li> <li>Replaced ad hoc build system with CMake</li>
<li>Replaced layout-dependent key codes with single, platform-independent set based on US layout</li> <li>Replaced layout-dependent key codes with single, platform-independent set based on US layout</li>
<li>Replaced mouse wheel interface with two-dimensional, floating point scrolling interface</li> <li>Replaced mouse wheel interface with two-dimensional, floating point scrolling interface</li>

View File

@ -860,9 +860,9 @@ static GLboolean createContext(_GLFWwindow* window,
// created // created
//======================================================================== //========================================================================
int _glfwPlatformOpenWindow(_GLFWwindow* window, int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig, const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig)
{ {
if (!initializeAppKit()) if (!initializeAppKit())
return GL_FALSE; return GL_FALSE;
@ -944,7 +944,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
// Properly kill the window / video display // Properly kill the window / video display
//======================================================================== //========================================================================
void _glfwPlatformCloseWindow(_GLFWwindow* window) void _glfwPlatformDestroyWindow(_GLFWwindow* window)
{ {
[window->NS.object orderOut:nil]; [window->NS.object orderOut:nil];

View File

@ -79,7 +79,7 @@ GLFWAPI void glfwTerminate(void)
// Close all remaining windows // Close all remaining windows
while (_glfwLibrary.windowListHead) while (_glfwLibrary.windowListHead)
glfwCloseWindow(_glfwLibrary.windowListHead); glfwDestroyWindow(_glfwLibrary.windowListHead);
if (!_glfwPlatformTerminate()) if (!_glfwPlatformTerminate())
return; return;

View File

@ -88,10 +88,10 @@ typedef struct _GLFWlibrary _GLFWlibrary;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Window hints, set by glfwOpenWindowHint and consumed by glfwOpenWindow // Window hints, set by glfwWindowHint and consumed by glfwCreateWindow
// A bucket of semi-random stuff lumped together for historical reasons // A bucket of semi-random stuff lumped together for historical reasons
// This is used only by the platform independent code and only to store // This is used only by the platform independent code and only to store
// parameters passed to us by glfwOpenWindowHint // parameters passed to us by glfwWindowHint
//------------------------------------------------------------------------ //------------------------------------------------------------------------
struct _GLFWhints struct _GLFWhints
{ {
@ -310,8 +310,8 @@ double _glfwPlatformGetTime(void);
void _glfwPlatformSetTime(double time); void _glfwPlatformSetTime(double time);
// Window management // Window management
int _glfwPlatformOpenWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig); int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig);
void _glfwPlatformCloseWindow(_GLFWwindow* window); void _glfwPlatformDestroyWindow(_GLFWwindow* window);
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title); void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title);
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height); void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height);
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y); void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y);

View File

@ -244,7 +244,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
//======================================================================== //========================================================================
// Checks whether the OpenGL part of the window config is sane // Checks whether the OpenGL part of the window config is sane
// It blames glfwOpenWindow because that's the only caller // It blames glfwCreateWindow because that's the only caller
//======================================================================== //========================================================================
GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig) GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
@ -253,28 +253,28 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
{ {
// OpenGL 1.0 is the smallest valid version // OpenGL 1.0 is the smallest valid version
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Invalid OpenGL version requested"); "glfwCreateWindow: Invalid OpenGL version requested");
return GL_FALSE; return GL_FALSE;
} }
if (wndconfig->glMajor == 1 && wndconfig->glMinor > 5) if (wndconfig->glMajor == 1 && wndconfig->glMinor > 5)
{ {
// OpenGL 1.x series ended with version 1.5 // OpenGL 1.x series ended with version 1.5
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Invalid OpenGL version requested"); "glfwCreateWindow: Invalid OpenGL version requested");
return GL_FALSE; return GL_FALSE;
} }
else if (wndconfig->glMajor == 2 && wndconfig->glMinor > 1) else if (wndconfig->glMajor == 2 && wndconfig->glMinor > 1)
{ {
// OpenGL 2.x series ended with version 2.1 // OpenGL 2.x series ended with version 2.1
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Invalid OpenGL version requested"); "glfwCreateWindow: Invalid OpenGL version requested");
return GL_FALSE; return GL_FALSE;
} }
else if (wndconfig->glMajor == 3 && wndconfig->glMinor > 3) else if (wndconfig->glMajor == 3 && wndconfig->glMinor > 3)
{ {
// OpenGL 3.x series ended with version 3.3 // OpenGL 3.x series ended with version 3.3
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Invalid OpenGL version requested"); "glfwCreateWindow: Invalid OpenGL version requested");
return GL_FALSE; return GL_FALSE;
} }
else else
@ -292,7 +292,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
// everything 2.x and let the driver report invalid 2.x versions // everything 2.x and let the driver report invalid 2.x versions
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Invalid OpenGL ES 2.x version requested"); "glfwCreateWindow: Invalid OpenGL ES 2.x version requested");
return GL_FALSE; return GL_FALSE;
} }
} }
@ -302,7 +302,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE) wndconfig->glProfile != GLFW_OPENGL_COMPAT_PROFILE)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM,
"glfwOpenWindow: Invalid OpenGL profile requested"); "glfwCreateWindow: Invalid OpenGL profile requested");
return GL_FALSE; return GL_FALSE;
} }
@ -313,7 +313,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
// and above // and above
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Context profiles only exist for " "glfwCreateWindow: Context profiles only exist for "
"OpenGL version 3.2 and above"); "OpenGL version 3.2 and above");
return GL_FALSE; return GL_FALSE;
} }
@ -323,7 +323,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
{ {
// Forward-compatible contexts are only defined for OpenGL version 3.0 and above // Forward-compatible contexts are only defined for OpenGL version 3.0 and above
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Forward compatibility only exist for " "glfwCreateWindow: Forward compatibility only exist for "
"OpenGL version 3.0 and above"); "OpenGL version 3.0 and above");
return GL_FALSE; return GL_FALSE;
} }
@ -334,7 +334,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
wndconfig->glRobustness != GLFW_OPENGL_LOSE_CONTEXT_ON_RESET) wndconfig->glRobustness != GLFW_OPENGL_LOSE_CONTEXT_ON_RESET)
{ {
_glfwSetError(GLFW_INVALID_VALUE, _glfwSetError(GLFW_INVALID_VALUE,
"glfwOpenWindow: Invalid OpenGL robustness mode requested"); "glfwCreateWindow: Invalid OpenGL robustness mode requested");
return GL_FALSE; return GL_FALSE;
} }
} }
@ -345,7 +345,7 @@ GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
//======================================================================== //========================================================================
// Reads back context properties // Reads back context properties
// It blames glfwOpenWindow because that's the only caller // It blames glfwCreateWindow because that's the only caller
//======================================================================== //========================================================================
GLboolean _glfwRefreshContextParams(void) GLboolean _glfwRefreshContextParams(void)
@ -369,7 +369,7 @@ GLboolean _glfwRefreshContextParams(void)
if (!window->GetStringi) if (!window->GetStringi)
{ {
_glfwSetError(GLFW_PLATFORM_ERROR, _glfwSetError(GLFW_PLATFORM_ERROR,
"glfwOpenWindow: Entry point retrieval is broken"); "glfwCreateWindow: Entry point retrieval is broken");
return GL_FALSE; return GL_FALSE;
} }
} }
@ -433,7 +433,7 @@ GLboolean _glfwRefreshContextParams(void)
//======================================================================== //========================================================================
// Checks whether the current context fulfils the specified requirements // Checks whether the current context fulfils the specified requirements
// It blames glfwOpenWindow because that's the only caller // It blames glfwCreateWindow because that's the only caller
//======================================================================== //========================================================================
GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig) GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig)
@ -452,7 +452,7 @@ GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig)
// {GLX|WGL}_ARB_create_context extension and fail here // {GLX|WGL}_ARB_create_context extension and fail here
_glfwSetError(GLFW_VERSION_UNAVAILABLE, _glfwSetError(GLFW_VERSION_UNAVAILABLE,
"glfwOpenWindow: The requested OpenGL version is not available"); "glfwCreateWindow: The requested OpenGL version is not available");
return GL_FALSE; return GL_FALSE;
} }

View File

@ -505,7 +505,7 @@ int _glfwCreateContext(_GLFWwindow* window,
void _glfwDestroyContext(_GLFWwindow* window) void _glfwDestroyContext(_GLFWwindow* window)
{ {
// This is duplicated from glfwCloseWindow // This is duplicated from glfwDestroyWindow
// TODO: Stop duplicating code // TODO: Stop duplicating code
if (window == _glfwLibrary.currentWindow) if (window == _glfwLibrary.currentWindow)
glfwMakeContextCurrent(NULL); glfwMakeContextCurrent(NULL);

View File

@ -886,7 +886,7 @@ static int createWindow(_GLFWwindow* window,
if (!wideTitle) if (!wideTitle)
{ {
_glfwSetError(GLFW_PLATFORM_ERROR, _glfwSetError(GLFW_PLATFORM_ERROR,
"glfwOpenWindow: Failed to convert title to wide string"); "glfwCreateWindow: Failed to convert title to wide string");
return GL_FALSE; return GL_FALSE;
} }
@ -931,7 +931,7 @@ static void destroyWindow(_GLFWwindow* window)
{ {
_glfwDestroyContext(window); _glfwDestroyContext(window);
// This is duplicated from glfwCloseWindow // This is duplicated from glfwDestroyWindow
// TODO: Stop duplicating code // TODO: Stop duplicating code
if (window == _glfwLibrary.activeWindow) if (window == _glfwLibrary.activeWindow)
_glfwLibrary.activeWindow = NULL; _glfwLibrary.activeWindow = NULL;
@ -953,9 +953,9 @@ static void destroyWindow(_GLFWwindow* window)
// created // created
//======================================================================== //========================================================================
int _glfwPlatformOpenWindow(_GLFWwindow* window, int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig, const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig)
{ {
GLboolean recreateContext = GL_FALSE; GLboolean recreateContext = GL_FALSE;
@ -1083,7 +1083,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
// Properly kill the window / video display // Properly kill the window / video display
//======================================================================== //========================================================================
void _glfwPlatformCloseWindow(_GLFWwindow* window) void _glfwPlatformDestroyWindow(_GLFWwindow* window)
{ {
destroyWindow(window); destroyWindow(window);

View File

@ -60,7 +60,7 @@ static void closeFlaggedWindows(void)
if (window->closeRequested) if (window->closeRequested)
{ {
_GLFWwindow* next = window->next; _GLFWwindow* next = window->next;
glfwCloseWindow(window); glfwDestroyWindow(window);
window = next; window = next;
} }
else else
@ -214,9 +214,9 @@ void _glfwInputWindowDamage(_GLFWwindow* window)
// Create the GLFW window and its associated context // Create the GLFW window and its associated context
//======================================================================== //========================================================================
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
int mode, const char* title, int mode, const char* title,
GLFWwindow share) GLFWwindow share)
{ {
_GLFWfbconfig fbconfig; _GLFWfbconfig fbconfig;
_GLFWwndconfig wndconfig; _GLFWwndconfig wndconfig;
@ -269,7 +269,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN) if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN)
{ {
_glfwSetError(GLFW_INVALID_ENUM, _glfwSetError(GLFW_INVALID_ENUM,
"glfwOpenWindow: Invalid enum for 'mode' parameter"); "glfwCreateWindow: Invalid enum for 'mode' parameter");
return GL_FALSE; return GL_FALSE;
} }
@ -295,7 +295,7 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
if (!window) if (!window)
{ {
_glfwSetError(GLFW_OUT_OF_MEMORY, _glfwSetError(GLFW_OUT_OF_MEMORY,
"glfwOpenWindow: Failed to allocate window structure"); "glfwCreateWindow: Failed to allocate window structure");
return NULL; return NULL;
} }
@ -312,9 +312,9 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
window->systemKeys = GL_TRUE; window->systemKeys = GL_TRUE;
// Open the actual window and create its context // Open the actual window and create its context
if (!_glfwPlatformOpenWindow(window, &wndconfig, &fbconfig)) if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
{ {
glfwCloseWindow(window); glfwDestroyWindow(window);
return GL_FALSE; return GL_FALSE;
} }
@ -325,14 +325,14 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
if (!_glfwRefreshContextParams()) if (!_glfwRefreshContextParams())
{ {
glfwCloseWindow(window); glfwDestroyWindow(window);
return GL_FALSE; return GL_FALSE;
} }
// Verify the context against the requested parameters // Verify the context against the requested parameters
if (!_glfwIsValidContext(&wndconfig)) if (!_glfwIsValidContext(&wndconfig))
{ {
glfwCloseWindow(window); glfwDestroyWindow(window);
return GL_FALSE; return GL_FALSE;
} }
@ -351,10 +351,10 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
//======================================================================== //========================================================================
// Set hints for opening the window // Set hints for creating the window
//======================================================================== //========================================================================
GLFWAPI void glfwOpenWindowHint(int target, int hint) GLFWAPI void glfwWindowHint(int target, int hint)
{ {
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
@ -438,7 +438,7 @@ GLFWAPI void glfwOpenWindowHint(int target, int hint)
// Properly kill the window / video display // Properly kill the window / video display
//======================================================================== //========================================================================
GLFWAPI void glfwCloseWindow(GLFWwindow handle) GLFWAPI void glfwDestroyWindow(GLFWwindow handle)
{ {
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
@ -460,7 +460,7 @@ GLFWAPI void glfwCloseWindow(GLFWwindow handle)
if (window == _glfwLibrary.activeWindow) if (window == _glfwLibrary.activeWindow)
_glfwLibrary.activeWindow = NULL; _glfwLibrary.activeWindow = NULL;
_glfwPlatformCloseWindow(window); _glfwPlatformDestroyWindow(window);
// Unlink window from global linked list // Unlink window from global linked list
{ {

View File

@ -914,9 +914,9 @@ void _glfwProcessPendingEvents(void)
// the OpenGL rendering context is created // the OpenGL rendering context is created
//======================================================================== //========================================================================
int _glfwPlatformOpenWindow(_GLFWwindow* window, int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig, const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig)
{ {
window->refreshRate = wndconfig->refreshRate; window->refreshRate = wndconfig->refreshRate;
window->resizable = wndconfig->resizable; window->resizable = wndconfig->resizable;
@ -973,7 +973,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
// Properly kill the window/video display // Properly kill the window/video display
//======================================================================== //========================================================================
void _glfwPlatformCloseWindow(_GLFWwindow* window) void _glfwPlatformDestroyWindow(_GLFWwindow* window)
{ {
if (window->mode == GLFW_FULLSCREEN) if (window->mode == GLFW_FULLSCREEN)
leaveFullscreenMode(window); leaveFullscreenMode(window);

View File

@ -87,7 +87,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(window_width, window_height, GLFW_WINDOWED, "", NULL); window = glfwCreateWindow(window_width, window_height, GLFW_WINDOWED, "", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -53,7 +53,7 @@ static void key_callback(GLFWwindow window, int key, int action)
switch (key) switch (key)
{ {
case GLFW_KEY_ESCAPE: case GLFW_KEY_ESCAPE:
glfwCloseWindow(window); glfwDestroyWindow(window);
break; break;
case GLFW_KEY_V: case GLFW_KEY_V:
@ -117,7 +117,7 @@ int main(int argc, char** argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Clipboard Test", NULL); window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Clipboard Test", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -74,7 +74,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Defaults", NULL); window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Defaults", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();
@ -94,7 +94,7 @@ int main(void)
glfwGetWindowParam(window, parameters[i].param)); glfwGetWindowParam(window, parameters[i].param));
} }
glfwCloseWindow(window); glfwDestroyWindow(window);
window = NULL; window = NULL;
glfwTerminate(); glfwTerminate();

View File

@ -367,7 +367,7 @@ int main(void)
glfwSetKeyCallback(key_callback); glfwSetKeyCallback(key_callback);
glfwSetCharCallback(char_callback); glfwSetCharCallback(char_callback);
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Event Linter", NULL); window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Event Linter", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -96,9 +96,9 @@ int main(int argc, char** argv)
glfwSetKeyCallback(key_callback); glfwSetKeyCallback(key_callback);
glfwSetWindowSizeCallback(window_size_callback); glfwSetWindowSizeCallback(window_size_callback);
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, samples); glfwWindowHint(GLFW_FSAA_SAMPLES, samples);
window = glfwOpenWindow(800, 400, GLFW_WINDOWED, "Aliasing Detector", NULL); window = glfwCreateWindow(800, 400, GLFW_WINDOWED, "Aliasing Detector", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -82,7 +82,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(640, 480, GLFW_FULLSCREEN, "Fullscreen focus", NULL); window = glfwCreateWindow(640, 480, GLFW_FULLSCREEN, "Fullscreen focus", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -60,7 +60,7 @@ static void key_callback(GLFWwindow window, int key, int action)
{ {
case GLFW_KEY_ESCAPE: case GLFW_KEY_ESCAPE:
{ {
glfwCloseWindow(window); glfwDestroyWindow(window);
break; break;
} }
@ -130,7 +130,7 @@ int main(int argc, char** argv)
height = 0; height = 0;
} }
window = glfwOpenWindow(width, height, mode, "Gamma Test", NULL); window = glfwCreateWindow(width, height, mode, "Gamma Test", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -191,26 +191,26 @@ int main(int argc, char** argv)
if (major != 1 || minor != 0) if (major != 1 || minor != 0)
{ {
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, major); glfwWindowHint(GLFW_OPENGL_VERSION_MAJOR, major);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, minor); glfwWindowHint(GLFW_OPENGL_VERSION_MINOR, minor);
} }
if (debug) if (debug)
glfwOpenWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
if (forward) if (forward)
glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
if (profile != 0) if (profile != 0)
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, profile); glfwWindowHint(GLFW_OPENGL_PROFILE, profile);
if (strategy) if (strategy)
glfwOpenWindowHint(GLFW_OPENGL_ROBUSTNESS, strategy); glfwWindowHint(GLFW_OPENGL_ROBUSTNESS, strategy);
// We assume here that we stand a better chance of success by leaving all // We assume here that we stand a better chance of success by leaving all
// possible details of pixel format selection to GLFW // possible details of pixel format selection to GLFW
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Version", NULL); window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Version", NULL);
if (!window) if (!window)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

View File

@ -55,7 +55,7 @@ static void key_callback(GLFWwindow window, int key, int action)
glfwIconifyWindow(window); glfwIconifyWindow(window);
break; break;
case GLFW_KEY_ESCAPE: case GLFW_KEY_ESCAPE:
glfwCloseWindow(window); glfwDestroyWindow(window);
break; break;
} }
} }
@ -111,7 +111,7 @@ int main(int argc, char** argv)
height = 0; height = 0;
} }
window = glfwOpenWindow(width, height, mode, "Iconify", NULL); window = glfwCreateWindow(width, height, mode, "Iconify", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -186,7 +186,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Joystick Test", NULL); window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Joystick Test", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -85,7 +85,7 @@ static void key_callback(GLFWwindow dummy, int key, int action)
{ {
if (key == GLFW_KEY_ESCAPE) if (key == GLFW_KEY_ESCAPE)
{ {
glfwCloseWindow(window); glfwDestroyWindow(window);
window = NULL; window = NULL;
} }
} }
@ -125,15 +125,15 @@ static void test_modes(void)
{ {
GLFWvidmode* mode = modes + i; GLFWvidmode* mode = modes + i;
glfwOpenWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_RED_BITS, mode->redBits);
glfwOpenWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
glfwOpenWindowHint(GLFW_BLUE_BITS, mode->blueBits); glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
printf("Testing mode %u: %s", (unsigned int) i, format_mode(mode)); printf("Testing mode %u: %s", (unsigned int) i, format_mode(mode));
window = glfwOpenWindow(mode->width, mode->height, window = glfwCreateWindow(mode->width, mode->height,
GLFW_FULLSCREEN, "Video Mode Test", GLFW_FULLSCREEN, "Video Mode Test",
NULL); NULL);
if (!window) if (!window)
{ {
printf("Failed to enter mode %u: %s\n", printf("Failed to enter mode %u: %s\n",
@ -182,7 +182,7 @@ static void test_modes(void)
printf("Closing window\n"); printf("Closing window\n");
glfwCloseWindow(window); glfwDestroyWindow(window);
glfwPollEvents(); glfwPollEvents();
window = NULL; window = NULL;
} }

View File

@ -78,7 +78,7 @@ static void key_callback(GLFWwindow window, int key, int action)
{ {
if (action == GLFW_PRESS) if (action == GLFW_PRESS)
{ {
glfwCloseWindow(window); glfwDestroyWindow(window);
open_window(); open_window();
} }
@ -94,7 +94,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
static GLboolean open_window(void) static GLboolean open_window(void)
{ {
window_handle = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Peter Detector", NULL); window_handle = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Peter Detector", NULL);
if (!window_handle) if (!window_handle)
return GL_FALSE; return GL_FALSE;

View File

@ -92,7 +92,7 @@ static GLboolean open_window(int width, int height, int mode)
base = glfwGetTime(); base = glfwGetTime();
window_handle = glfwOpenWindow(width, height, mode, "Window Re-opener", NULL); window_handle = glfwCreateWindow(width, height, mode, "Window Re-opener", NULL);
if (!window_handle) if (!window_handle)
{ {
fprintf(stderr, "Failed to open %s mode GLFW window: %s\n", get_mode_name(mode), glfwErrorString(glfwGetError())); fprintf(stderr, "Failed to open %s mode GLFW window: %s\n", get_mode_name(mode), glfwErrorString(glfwGetError()));
@ -115,7 +115,7 @@ static void close_window(void)
{ {
double base = glfwGetTime(); double base = glfwGetTime();
glfwCloseWindow(window_handle); glfwDestroyWindow(window_handle);
window_handle = NULL; window_handle = NULL;
printf("Closing window took %0.3f seconds\n", glfwGetTime() - base); printf("Closing window took %0.3f seconds\n", glfwGetTime() - base);

View File

@ -41,7 +41,7 @@ static GLFWwindow windows[2];
static void key_callback(GLFWwindow window, int key, int action) static void key_callback(GLFWwindow window, int key, int action)
{ {
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE) if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
glfwCloseWindow(window); glfwDestroyWindow(window);
} }
static int window_close_callback(GLFWwindow window) static int window_close_callback(GLFWwindow window)
@ -64,7 +64,7 @@ static GLFWwindow open_window(const char* title, GLFWwindow share)
{ {
GLFWwindow window; GLFWwindow window;
window = glfwOpenWindow(WIDTH, HEIGHT, GLFW_WINDOWED, title, share); window = glfwCreateWindow(WIDTH, HEIGHT, GLFW_WINDOWED, title, share);
if (!window) if (!window)
return NULL; return NULL;

View File

@ -72,7 +72,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "", NULL); window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "", NULL);
if (!window) if (!window)
{ {
glfwTerminate(); glfwTerminate();

View File

@ -47,7 +47,7 @@ int main(void)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "English 日本語 русский язык 官話", NULL); window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "English 日本語 русский язык 官話", NULL);
if (!window) if (!window)
{ {
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError())); fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));

View File

@ -64,7 +64,7 @@ int main(void)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
windows[i] = glfwOpenWindow(200, 200, GLFW_WINDOWED, titles[i], NULL); windows[i] = glfwCreateWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
if (!windows[i]) if (!windows[i])
{ {
fprintf(stderr, "Failed to open GLFW window: %s\n", fprintf(stderr, "Failed to open GLFW window: %s\n",