mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 10:05:10 +00:00
Begun integrating monitor and window.
This commit is contained in:
parent
7aaeb6955b
commit
1be1636326
@ -581,7 +581,7 @@ int main( void )
|
|||||||
|
|
||||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||||
|
|
||||||
window = glfwCreateWindow( 400, 400, GLFW_WINDOWED, "Boing (classic Amiga demo)", NULL );
|
window = glfwCreateWindow( 400, 400, "Boing (classic Amiga demo)", NULL, NULL );
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Failed to open GLFW window\n" );
|
fprintf( stderr, "Failed to open GLFW window\n" );
|
||||||
|
@ -345,7 +345,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||||
|
|
||||||
window = glfwCreateWindow( 300, 300, GLFW_WINDOWED, "Gears", NULL );
|
window = glfwCreateWindow( 300, 300, "Gears", NULL, NULL );
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Failed to open GLFW window\n" );
|
fprintf( stderr, "Failed to open GLFW window\n" );
|
||||||
|
@ -587,7 +587,7 @@ int main(int argc, char** argv)
|
|||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);
|
||||||
|
|
||||||
window = glfwCreateWindow(800, 600, GLFW_WINDOWED, "GLFW OpenGL3 Heightmap demo", NULL);
|
window = glfwCreateWindow(800, 600, "GLFW OpenGL3 Heightmap demo", NULL, 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");
|
||||||
|
@ -459,7 +459,7 @@ int main(void)
|
|||||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||||
|
|
||||||
// Open OpenGL window
|
// Open OpenGL window
|
||||||
window = glfwCreateWindow(500, 500, GLFW_WINDOWED, "Split view demo", NULL);
|
window = glfwCreateWindow(500, 500, "Split view demo", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to open GLFW window\n");
|
fprintf(stderr, "Failed to open GLFW window\n");
|
||||||
|
@ -23,7 +23,7 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Open a window and create its OpenGL context
|
// Open a window and create its OpenGL context
|
||||||
window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Spinning Triangle", NULL);
|
window = glfwCreateWindow(640, 480, "Spinning Triangle", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to open GLFW window\n");
|
fprintf(stderr, "Failed to open GLFW window\n");
|
||||||
|
@ -406,7 +406,7 @@ int main(int argc, char* argv[])
|
|||||||
glfwSetCursorPosCallback(cursor_position_callback);
|
glfwSetCursorPosCallback(cursor_position_callback);
|
||||||
glfwSetScrollCallback(scroll_callback);
|
glfwSetScrollCallback(scroll_callback);
|
||||||
|
|
||||||
window = glfwCreateWindow(640, 480, GLFW_WINDOWED, "Wave Simulation", NULL);
|
window = glfwCreateWindow(640, 480, "Wave Simulation", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open window\n");
|
fprintf(stderr, "Could not open window\n");
|
||||||
|
@ -375,10 +375,6 @@ extern "C" {
|
|||||||
* Other definitions
|
* Other definitions
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/* glfwCreateWindow modes */
|
|
||||||
#define GLFW_WINDOWED 0x00010001
|
|
||||||
#define GLFW_FULLSCREEN 0x00010002
|
|
||||||
|
|
||||||
/* glfwGetWindowParam tokens */
|
/* glfwGetWindowParam tokens */
|
||||||
#define GLFW_ACTIVE 0x00020001
|
#define GLFW_ACTIVE 0x00020001
|
||||||
#define GLFW_ICONIFIED 0x00020002
|
#define GLFW_ICONIFIED 0x00020002
|
||||||
@ -548,7 +544,7 @@ GLFWAPI void glfwSetGammaRamp(const GLFWgammaramp* ramp);
|
|||||||
|
|
||||||
/* Window handling */
|
/* Window handling */
|
||||||
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, const char* title, GLFWmonitor monitor, GLFWwindow share);
|
||||||
GLFWAPI void glfwDestroyWindow(GLFWwindow window);
|
GLFWAPI void glfwDestroyWindow(GLFWwindow window);
|
||||||
GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title);
|
GLFWAPI void glfwSetWindowTitle(GLFWwindow window, const char* title);
|
||||||
GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height);
|
GLFWAPI void glfwGetWindowSize(GLFWwindow window, int* width, int* height);
|
||||||
|
@ -297,7 +297,6 @@ version of GLFW.</p>
|
|||||||
<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>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_NO_RESIZE</code> to <code>GLFW_RESIZABLE</code></li>
|
<li>Renamed <code>GLFW_WINDOW_NO_RESIZE</code> to <code>GLFW_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>
|
||||||
@ -322,6 +321,7 @@ version of GLFW.</p>
|
|||||||
<li>Removed <code>glfwGetNumberOfProcessors</code> function</li>
|
<li>Removed <code>glfwGetNumberOfProcessors</code> function</li>
|
||||||
<li>Removed <code>glfwGetGLVersion</code> function</li>
|
<li>Removed <code>glfwGetGLVersion</code> function</li>
|
||||||
<li>Removed <code>GLFW_OPENED</code> window parameter</li>
|
<li>Removed <code>GLFW_OPENED</code> window parameter</li>
|
||||||
|
<li>Removed <code>GLFW_WINDOW</code> and <code>GLFW_FULLSCREEN</code></li>
|
||||||
<li>Removed nonsensical key actions for Unicode character input</li>
|
<li>Removed nonsensical key actions for Unicode character input</li>
|
||||||
<li>Removed <code>GLFWCALL</code> and <code>GLFWAPIENTRY</code> macros for stdcall calling convention</li>
|
<li>Removed <code>GLFWCALL</code> and <code>GLFWAPIENTRY</code> macros for stdcall calling convention</li>
|
||||||
<li>Removed <code>GLFW_ACCELERATED</code> window parameter</li>
|
<li>Removed <code>GLFW_ACCELERATED</code> window parameter</li>
|
||||||
|
@ -674,7 +674,9 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
unsigned int styleMask = 0;
|
unsigned int styleMask = 0;
|
||||||
|
|
||||||
if (wndconfig->mode == GLFW_WINDOWED)
|
if (wndconfig->monitor)
|
||||||
|
styleMask = NSBorderlessWindowMask;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
styleMask = NSTitledWindowMask | NSClosableWindowMask |
|
styleMask = NSTitledWindowMask | NSClosableWindowMask |
|
||||||
NSMiniaturizableWindowMask;
|
NSMiniaturizableWindowMask;
|
||||||
@ -682,8 +684,6 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
if (wndconfig->resizable)
|
if (wndconfig->resizable)
|
||||||
styleMask |= NSResizableWindowMask;
|
styleMask |= NSResizableWindowMask;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
styleMask = NSBorderlessWindowMask;
|
|
||||||
|
|
||||||
window->NS.object = [[NSWindow alloc]
|
window->NS.object = [[NSWindow alloc]
|
||||||
initWithContentRect:NSMakeRect(0, 0, window->width, window->height)
|
initWithContentRect:NSMakeRect(0, 0, window->width, window->height)
|
||||||
@ -788,7 +788,7 @@ static GLboolean createContext(_GLFWwindow* window,
|
|||||||
|
|
||||||
ADD_ATTR(NSOpenGLPFADoubleBuffer);
|
ADD_ATTR(NSOpenGLPFADoubleBuffer);
|
||||||
|
|
||||||
if (wndconfig->mode == GLFW_FULLSCREEN)
|
if (wndconfig->monitor)
|
||||||
{
|
{
|
||||||
ADD_ATTR(NSOpenGLPFANoRecovery);
|
ADD_ATTR(NSOpenGLPFANoRecovery);
|
||||||
ADD_ATTR2(NSOpenGLPFAScreenMask,
|
ADD_ATTR2(NSOpenGLPFAScreenMask,
|
||||||
@ -919,7 +919,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
[window->NSGL.context setView:[window->NS.object contentView]];
|
[window->NSGL.context setView:[window->NS.object contentView]];
|
||||||
|
|
||||||
if (wndconfig->mode == GLFW_FULLSCREEN)
|
if (wndconfig->monitor)
|
||||||
{
|
{
|
||||||
int bpp = colorBits + fbconfig->alphaBits;
|
int bpp = colorBits + fbconfig->alphaBits;
|
||||||
|
|
||||||
@ -952,7 +952,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
[window->NS.object orderOut:nil];
|
[window->NS.object orderOut:nil];
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
[[window->NS.object contentView] exitFullScreenModeWithOptions:nil];
|
[[window->NS.object contentView] exitFullScreenModeWithOptions:nil];
|
||||||
|
|
||||||
@ -1121,7 +1121,7 @@ void _glfwPlatformWaitEvents( void )
|
|||||||
|
|
||||||
void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y)
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, int x, int y)
|
||||||
{
|
{
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
CGPoint globalPoint = CGPointMake(x, y);
|
CGPoint globalPoint = CGPointMake(x, y);
|
||||||
CGDisplayMoveCursorToPoint(CGMainDisplayID(), globalPoint);
|
CGDisplayMoveCursorToPoint(CGMainDisplayID(), globalPoint);
|
||||||
|
@ -129,6 +129,7 @@ struct _GLFWwndconfig
|
|||||||
GLboolean glDebug;
|
GLboolean glDebug;
|
||||||
int glProfile;
|
int glProfile;
|
||||||
int glRobustness;
|
int glRobustness;
|
||||||
|
_GLFWmonitor* monitor;
|
||||||
_GLFWwindow* share;
|
_GLFWwindow* share;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,6 +177,7 @@ struct _GLFWwindow
|
|||||||
GLboolean visible; // GL_TRUE if this window is visible
|
GLboolean visible; // GL_TRUE if this window is visible
|
||||||
int refreshRate; // monitor refresh rate
|
int refreshRate; // monitor refresh rate
|
||||||
void* userPointer;
|
void* userPointer;
|
||||||
|
_GLFWmonitor* monitor;
|
||||||
|
|
||||||
// Window input state
|
// Window input state
|
||||||
GLboolean stickyKeys;
|
GLboolean stickyKeys;
|
||||||
|
@ -156,12 +156,20 @@ void _glfwInputMonitorChange(void)
|
|||||||
|
|
||||||
for (i = 0; i < _glfwLibrary.monitorCount; i++)
|
for (i = 0; i < _glfwLibrary.monitorCount; i++)
|
||||||
{
|
{
|
||||||
|
_GLFWwindow* window;
|
||||||
|
|
||||||
if (_glfwLibrary.monitors[i] == NULL)
|
if (_glfwLibrary.monitors[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// This monitor is no longer connected
|
// This monitor is no longer connected
|
||||||
_glfwLibrary.monitorCallback(_glfwLibrary.monitors[i],
|
_glfwLibrary.monitorCallback(_glfwLibrary.monitors[i],
|
||||||
GLFW_MONITOR_DISCONNECTED);
|
GLFW_MONITOR_DISCONNECTED);
|
||||||
|
|
||||||
|
for (window = _glfwLibrary.windowListHead; window; window = window->next)
|
||||||
|
{
|
||||||
|
if (window->monitor == _glfwLibrary.monitors[i])
|
||||||
|
window->monitor = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwDestroyMonitors();
|
_glfwDestroyMonitors();
|
||||||
|
@ -344,7 +344,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||||
showCursor(window);
|
showCursor(window);
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
if (!iconified)
|
if (!iconified)
|
||||||
{
|
{
|
||||||
@ -367,7 +367,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
if (window->cursorMode == GLFW_CURSOR_CAPTURED)
|
||||||
captureCursor(window);
|
captureCursor(window);
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
if (!_glfwLibrary.Win32.monitor.modeChanged)
|
if (!_glfwLibrary.Win32.monitor.modeChanged)
|
||||||
{
|
{
|
||||||
@ -400,7 +400,7 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
|||||||
case SC_SCREENSAVE:
|
case SC_SCREENSAVE:
|
||||||
case SC_MONITORPOWER:
|
case SC_MONITORPOWER:
|
||||||
{
|
{
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
// We are running in fullscreen mode, so disallow
|
// We are running in fullscreen mode, so disallow
|
||||||
// screen saver and screen blanking
|
// screen saver and screen blanking
|
||||||
@ -738,7 +738,7 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
dwExStyle = WS_EX_APPWINDOW;
|
dwExStyle = WS_EX_APPWINDOW;
|
||||||
|
|
||||||
// Set window style, depending on fullscreen mode
|
// Set window style, depending on fullscreen mode
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
dwStyle |= WS_POPUP;
|
dwStyle |= WS_POPUP;
|
||||||
|
|
||||||
@ -775,7 +775,7 @@ static int createWindow(_GLFWwindow* window,
|
|||||||
// Adjust window position to working area (e.g. if the task bar is at
|
// Adjust window position to working area (e.g. if the task bar is at
|
||||||
// the top of the display). Fullscreen windows are always opened in
|
// the top of the display). Fullscreen windows are always opened in
|
||||||
// the upper left corner regardless of the desktop working area.
|
// the upper left corner regardless of the desktop working area.
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
wa.left = wa.top = 0;
|
wa.left = wa.top = 0;
|
||||||
else
|
else
|
||||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0);
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &wa, 0);
|
||||||
@ -866,7 +866,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
int bpp = fbconfig->redBits + fbconfig->greenBits + fbconfig->blueBits;
|
int bpp = fbconfig->redBits + fbconfig->greenBits + fbconfig->blueBits;
|
||||||
if (bpp < 15 || bpp >= 24)
|
if (bpp < 15 || bpp >= 24)
|
||||||
@ -962,7 +962,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
// Place the window above all topmost windows
|
// Place the window above all topmost windows
|
||||||
_glfwPlatformShowWindow(window);
|
_glfwPlatformShowWindow(window);
|
||||||
@ -982,7 +982,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
destroyWindow(window);
|
destroyWindow(window);
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
if (_glfwLibrary.Win32.monitor.modeChanged)
|
if (_glfwLibrary.Win32.monitor.modeChanged)
|
||||||
{
|
{
|
||||||
@ -1021,7 +1021,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
{
|
{
|
||||||
GLboolean sizeChanged = GL_FALSE;
|
GLboolean sizeChanged = GL_FALSE;
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
if (width > window->width || height > window->height)
|
if (width > window->width || height > window->height)
|
||||||
{
|
{
|
||||||
|
28
src/window.c
28
src/window.c
@ -224,7 +224,8 @@ void _glfwInputWindowCloseRequest(_GLFWwindow* window)
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
||||||
int mode, const char* title,
|
const char* title,
|
||||||
|
GLFWmonitor monitor,
|
||||||
GLFWwindow share)
|
GLFWwindow share)
|
||||||
{
|
{
|
||||||
_GLFWfbconfig fbconfig;
|
_GLFWfbconfig fbconfig;
|
||||||
@ -257,7 +258,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
fbconfig.samples = Max(_glfwLibrary.hints.samples, 0);
|
fbconfig.samples = Max(_glfwLibrary.hints.samples, 0);
|
||||||
|
|
||||||
// Set up desired window config
|
// Set up desired window config
|
||||||
wndconfig.mode = mode;
|
|
||||||
wndconfig.title = title;
|
wndconfig.title = title;
|
||||||
wndconfig.refreshRate = Max(_glfwLibrary.hints.refreshRate, 0);
|
wndconfig.refreshRate = Max(_glfwLibrary.hints.refreshRate, 0);
|
||||||
wndconfig.resizable = _glfwLibrary.hints.resizable ? GL_TRUE : GL_FALSE;
|
wndconfig.resizable = _glfwLibrary.hints.resizable ? GL_TRUE : GL_FALSE;
|
||||||
@ -268,6 +268,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
wndconfig.glDebug = _glfwLibrary.hints.glDebug ? GL_TRUE : GL_FALSE;
|
wndconfig.glDebug = _glfwLibrary.hints.glDebug ? GL_TRUE : GL_FALSE;
|
||||||
wndconfig.glProfile = _glfwLibrary.hints.glProfile;
|
wndconfig.glProfile = _glfwLibrary.hints.glProfile;
|
||||||
wndconfig.glRobustness = _glfwLibrary.hints.glRobustness ? GL_TRUE : GL_FALSE;
|
wndconfig.glRobustness = _glfwLibrary.hints.glRobustness ? GL_TRUE : GL_FALSE;
|
||||||
|
wndconfig.monitor = (_GLFWmonitor*) monitor;
|
||||||
wndconfig.share = share;
|
wndconfig.share = share;
|
||||||
|
|
||||||
// Reset to default values for the next call
|
// Reset to default values for the next call
|
||||||
@ -280,13 +281,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
// Save the currently current context so it can be restored later
|
// Save the currently current context so it can be restored later
|
||||||
previous = glfwGetCurrentContext();
|
previous = glfwGetCurrentContext();
|
||||||
|
|
||||||
if (mode != GLFW_WINDOWED && mode != GLFW_FULLSCREEN)
|
|
||||||
{
|
|
||||||
_glfwSetError(GLFW_INVALID_ENUM,
|
|
||||||
"glfwCreateWindow: Invalid window mode");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check width & height
|
// Check width & height
|
||||||
if (width > 0 && height <= 0)
|
if (width > 0 && height <= 0)
|
||||||
{
|
{
|
||||||
@ -320,10 +314,10 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
// Remember window settings
|
// Remember window settings
|
||||||
window->width = width;
|
window->width = width;
|
||||||
window->height = height;
|
window->height = height;
|
||||||
window->mode = mode;
|
|
||||||
window->resizable = wndconfig.resizable;
|
window->resizable = wndconfig.resizable;
|
||||||
window->cursorMode = GLFW_CURSOR_NORMAL;
|
window->cursorMode = GLFW_CURSOR_NORMAL;
|
||||||
window->systemKeys = GL_TRUE;
|
window->systemKeys = GL_TRUE;
|
||||||
|
window->monitor = (_GLFWmonitor*) monitor;
|
||||||
|
|
||||||
// Open the actual window and create its context
|
// Open the actual window and create its context
|
||||||
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
||||||
@ -364,10 +358,10 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
|
|
||||||
// The GLFW specification states that fullscreen windows have the cursor
|
// The GLFW specification states that fullscreen windows have the cursor
|
||||||
// captured by default
|
// captured by default
|
||||||
if (mode == GLFW_FULLSCREEN)
|
if (wndconfig.monitor)
|
||||||
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
|
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
|
||||||
|
|
||||||
if (mode == GLFW_WINDOWED && wndconfig.visible)
|
if (wndconfig.monitor == NULL && wndconfig.visible)
|
||||||
glfwShowWindow(window);
|
glfwShowWindow(window);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
@ -570,7 +564,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow handle, int width, int height)
|
|||||||
|
|
||||||
_glfwPlatformSetWindowSize(window, width, height);
|
_glfwPlatformSetWindowSize(window, width, height);
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
// Refresh window parameters (may have changed due to changed video
|
// Refresh window parameters (may have changed due to changed video
|
||||||
// modes)
|
// modes)
|
||||||
@ -615,7 +609,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow handle, int xpos, int ypos)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN || window->iconified)
|
if (window->monitor || window->iconified)
|
||||||
{
|
{
|
||||||
// TODO: Figure out if this is an error
|
// TODO: Figure out if this is an error
|
||||||
return;
|
return;
|
||||||
@ -665,7 +659,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow handle)
|
|||||||
|
|
||||||
_glfwPlatformRestoreWindow(window);
|
_glfwPlatformRestoreWindow(window);
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
_glfwPlatformRefreshWindowParams(window);
|
_glfwPlatformRefreshWindowParams(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +678,7 @@ GLFWAPI void glfwShowWindow(GLFWwindow handle)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_glfwPlatformShowWindow(window);
|
_glfwPlatformShowWindow(window);
|
||||||
@ -705,7 +699,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow handle)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_glfwPlatformHideWindow(window);
|
_glfwPlatformHideWindow(window);
|
||||||
|
@ -107,7 +107,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
ExposureMask | FocusChangeMask | VisibilityChangeMask |
|
||||||
EnterWindowMask | LeaveWindowMask;
|
EnterWindowMask | LeaveWindowMask;
|
||||||
|
|
||||||
if (wndconfig->mode == GLFW_WINDOWED)
|
if (!wndconfig->monitor)
|
||||||
{
|
{
|
||||||
// The /only/ reason for setting the background pixel here is that
|
// The /only/ reason for setting the background pixel here is that
|
||||||
// otherwise our window won't get any decorations on systems using
|
// otherwise our window won't get any decorations on systems using
|
||||||
@ -138,7 +138,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN && !_glfwLibrary.X11.hasEWMH)
|
if (window->monitor && !_glfwLibrary.X11.hasEWMH)
|
||||||
{
|
{
|
||||||
// This is the butcher's way of removing window decorations
|
// This is the butcher's way of removing window decorations
|
||||||
// Setting the override-redirect attribute on a window makes the window
|
// Setting the override-redirect attribute on a window makes the window
|
||||||
@ -851,7 +851,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
#endif /*_GLFW_HAS_XRANDR*/
|
#endif /*_GLFW_HAS_XRANDR*/
|
||||||
|
|
||||||
if (wndconfig->mode == GLFW_FULLSCREEN)
|
if (wndconfig->monitor)
|
||||||
{
|
{
|
||||||
_glfwPlatformShowWindow(window);
|
_glfwPlatformShowWindow(window);
|
||||||
enterFullscreenMode(window);
|
enterFullscreenMode(window);
|
||||||
@ -887,7 +887,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
leaveFullscreenMode(window);
|
leaveFullscreenMode(window);
|
||||||
|
|
||||||
_glfwDestroyContext(window);
|
_glfwDestroyContext(window);
|
||||||
@ -959,7 +959,7 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
|
|
||||||
rate = window->refreshRate;
|
rate = window->refreshRate;
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
if (window->monitor)
|
||||||
{
|
{
|
||||||
// Get the closest matching video mode for the specified window size
|
// Get the closest matching video mode for the specified window size
|
||||||
mode = _glfwGetClosestVideoMode(&width, &height, &rate);
|
mode = _glfwGetClosestVideoMode(&width, &height, &rate);
|
||||||
@ -979,15 +979,17 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|||||||
XFree(hints);
|
XFree(hints);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change window size before changing fullscreen mode?
|
if (window->monitor)
|
||||||
if (window->mode == GLFW_FULLSCREEN && (width > window->width))
|
|
||||||
{
|
{
|
||||||
XResizeWindow(_glfwLibrary.X11.display, window->X11.handle, width, height);
|
// Change window size before changing fullscreen mode?
|
||||||
sizeChanged = GL_TRUE;
|
if (width > window->width)
|
||||||
}
|
{
|
||||||
|
XResizeWindow(_glfwLibrary.X11.display,
|
||||||
|
window->X11.handle,
|
||||||
|
width, height);
|
||||||
|
sizeChanged = GL_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (window->mode == GLFW_FULLSCREEN)
|
|
||||||
{
|
|
||||||
// Change video mode, keeping current refresh rate
|
// Change video mode, keeping current refresh rate
|
||||||
_glfwSetVideoModeMODE(mode, window->refreshRate);
|
_glfwSetVideoModeMODE(mode, window->refreshRate);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ int main(void)
|
|||||||
glfwSetWindowSizeCallback(window_size_callback);
|
glfwSetWindowSizeCallback(window_size_callback);
|
||||||
glfwSetKeyCallback(key_callback);
|
glfwSetKeyCallback(key_callback);
|
||||||
|
|
||||||
window = glfwCreateWindow(window_width, window_height, GLFW_WINDOWED, "", NULL);
|
window = glfwCreateWindow(window_width, window_height, "", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -125,7 +125,7 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Clipboard Test", NULL);
|
window = glfwCreateWindow(0, 0, "Clipboard Test", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -85,7 +85,7 @@ int main(void)
|
|||||||
|
|
||||||
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
||||||
|
|
||||||
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Defaults", NULL);
|
window = glfwCreateWindow(0, 0, "Defaults", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -399,7 +399,7 @@ int main(void)
|
|||||||
glfwSetCharCallback(char_callback);
|
glfwSetCharCallback(char_callback);
|
||||||
glfwSetMonitorCallback(monitor_callback);
|
glfwSetMonitorCallback(monitor_callback);
|
||||||
|
|
||||||
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Event Linter", NULL);
|
window = glfwCreateWindow(0, 0, "Event Linter", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -98,7 +98,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
glfwWindowHint(GLFW_FSAA_SAMPLES, samples);
|
glfwWindowHint(GLFW_FSAA_SAMPLES, samples);
|
||||||
|
|
||||||
window = glfwCreateWindow(800, 400, GLFW_WINDOWED, "Aliasing Detector", NULL);
|
window = glfwCreateWindow(800, 400, "Aliasing Detector", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -82,7 +82,7 @@ int main(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(640, 480, GLFW_FULLSCREEN, "Fullscreen focus", NULL);
|
window = glfwCreateWindow(640, 480, "Fullscreen focus", glfwGetPrimaryMonitor(), NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -97,7 +97,7 @@ static void size_callback(GLFWwindow window, int width, int height)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int width, height, ch;
|
int width, height, ch;
|
||||||
int mode = GLFW_WINDOWED;
|
GLFWmonitor monitor = NULL;
|
||||||
GLFWwindow window;
|
GLFWwindow window;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "fh")) != -1)
|
while ((ch = getopt(argc, argv, "fh")) != -1)
|
||||||
@ -109,7 +109,7 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
mode = GLFW_FULLSCREEN;
|
monitor = glfwGetPrimaryMonitor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -124,10 +124,10 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == GLFW_FULLSCREEN)
|
if (monitor)
|
||||||
{
|
{
|
||||||
GLFWvidmode mode;
|
GLFWvidmode mode;
|
||||||
glfwGetVideoMode(glfwGetPrimaryMonitor(), &mode);
|
glfwGetVideoMode(monitor, &mode);
|
||||||
width = mode.width;
|
width = mode.width;
|
||||||
height = mode.height;
|
height = mode.height;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ int main(int argc, char** argv)
|
|||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(width, height, mode, "Gamma Test", NULL);
|
window = glfwCreateWindow(width, height, "Gamma Test", monitor, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -243,7 +243,7 @@ int main(int argc, char** argv)
|
|||||||
// 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 = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Version", NULL);
|
window = glfwCreateWindow(0, 0, "Version", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
|||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int width, height, ch;
|
int width, height, ch;
|
||||||
int mode = GLFW_WINDOWED;
|
|
||||||
GLboolean active = -1, iconified = -1;
|
GLboolean active = -1, iconified = -1;
|
||||||
|
GLFWmonitor monitor = NULL;
|
||||||
GLFWwindow window;
|
GLFWwindow window;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "fh")) != -1)
|
while ((ch = getopt(argc, argv, "fh")) != -1)
|
||||||
@ -91,7 +91,7 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
mode = GLFW_FULLSCREEN;
|
monitor = glfwGetPrimaryMonitor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -106,12 +106,12 @@ int main(int argc, char** argv)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == GLFW_FULLSCREEN)
|
if (monitor)
|
||||||
{
|
{
|
||||||
GLFWvidmode current_mode;
|
GLFWvidmode mode;
|
||||||
glfwGetVideoMode(glfwGetPrimaryMonitor(), ¤t_mode);
|
glfwGetVideoMode(monitor, &mode);
|
||||||
width = current_mode.width;
|
width = mode.width;
|
||||||
height = current_mode.height;
|
height = mode.height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -119,7 +119,7 @@ int main(int argc, char** argv)
|
|||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(width, height, mode, "Iconify", NULL);
|
window = glfwCreateWindow(width, height, "Iconify", monitor, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -186,7 +186,7 @@ int main(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Joystick Test", NULL);
|
window = glfwCreateWindow(0, 0, "Joystick Test", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -144,7 +144,8 @@ static void test_modes(GLFWmonitor monitor)
|
|||||||
format_mode(mode));
|
format_mode(mode));
|
||||||
|
|
||||||
window_handle = glfwCreateWindow(mode->width, mode->height,
|
window_handle = glfwCreateWindow(mode->width, mode->height,
|
||||||
GLFW_FULLSCREEN, "Video Mode Test",
|
"Video Mode Test",
|
||||||
|
glfwGetPrimaryMonitor(),
|
||||||
NULL);
|
NULL);
|
||||||
if (!window_handle)
|
if (!window_handle)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
|||||||
|
|
||||||
static GLboolean open_window(void)
|
static GLboolean open_window(void)
|
||||||
{
|
{
|
||||||
window_handle = glfwCreateWindow(0, 0, GLFW_WINDOWED, "Peter Detector", NULL);
|
window_handle = glfwCreateWindow(0, 0, "Peter Detector", NULL, NULL);
|
||||||
if (!window_handle)
|
if (!window_handle)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
|
@ -41,19 +41,6 @@
|
|||||||
static GLFWwindow window_handle = NULL;
|
static GLFWwindow window_handle = NULL;
|
||||||
static GLboolean closed = GL_FALSE;
|
static GLboolean closed = GL_FALSE;
|
||||||
|
|
||||||
static const char* get_mode_name(int mode)
|
|
||||||
{
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case GLFW_WINDOWED:
|
|
||||||
return "windowed";
|
|
||||||
case GLFW_FULLSCREEN:
|
|
||||||
return "fullscreen";
|
|
||||||
default:
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
@ -80,22 +67,18 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLboolean open_window(int width, int height, int mode)
|
static GLboolean open_window(int width, int height, GLFWmonitor monitor)
|
||||||
{
|
{
|
||||||
double base;
|
double base;
|
||||||
|
|
||||||
if (!glfwInit())
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
base = glfwGetTime();
|
base = glfwGetTime();
|
||||||
|
|
||||||
window_handle = glfwCreateWindow(width, height, mode, "Window Re-opener", NULL);
|
window_handle = glfwCreateWindow(width, height, "Window Re-opener", monitor, 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",
|
||||||
|
monitor ? "fullscreen" : "windowed",
|
||||||
|
glfwErrorString(glfwGetError()));
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +90,7 @@ static GLboolean open_window(int width, int height, int mode)
|
|||||||
glfwSetKeyCallback(key_callback);
|
glfwSetKeyCallback(key_callback);
|
||||||
|
|
||||||
printf("Opening %s mode window took %0.3f seconds\n",
|
printf("Opening %s mode window took %0.3f seconds\n",
|
||||||
get_mode_name(mode),
|
monitor ? "fullscreen" : "windowed",
|
||||||
glfwGetTime() - base);
|
glfwGetTime() - base);
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
@ -121,17 +104,26 @@ static void close_window(void)
|
|||||||
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);
|
||||||
|
|
||||||
glfwTerminate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
if (!glfwInit())
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!open_window(640, 480, (count & 1) ? GLFW_FULLSCREEN : GLFW_WINDOWED))
|
GLFWmonitor monitor = NULL;
|
||||||
|
|
||||||
|
if (count & 1)
|
||||||
|
monitor = glfwGetPrimaryMonitor();
|
||||||
|
|
||||||
|
if (!open_window(640, 480, monitor))
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
@ -55,7 +55,7 @@ static GLFWwindow open_window(const char* title, GLFWwindow share)
|
|||||||
{
|
{
|
||||||
GLFWwindow window;
|
GLFWwindow window;
|
||||||
|
|
||||||
window = glfwCreateWindow(WIDTH, HEIGHT, GLFW_WINDOWED, title, share);
|
window = glfwCreateWindow(WIDTH, HEIGHT, title, NULL, share);
|
||||||
if (!window)
|
if (!window)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ int main(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "", NULL);
|
window = glfwCreateWindow(0, 0, "", NULL, NULL);
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -90,9 +90,8 @@ int main(void)
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
threads[i].window = glfwCreateWindow(200, 200,
|
threads[i].window = glfwCreateWindow(200, 200,
|
||||||
GLFW_WINDOWED,
|
|
||||||
threads[i].title,
|
threads[i].title,
|
||||||
NULL);
|
NULL, NULL);
|
||||||
if (!threads[i].window)
|
if (!threads[i].window)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to open GLFW window: %s\n",
|
fprintf(stderr, "Failed to open GLFW window: %s\n",
|
||||||
|
@ -47,7 +47,7 @@ int main(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = glfwCreateWindow(0, 0, GLFW_WINDOWED, "English 日本語 русский язык 官話", NULL);
|
window = glfwCreateWindow(0, 0, "English 日本語 русский язык 官話", NULL, 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()));
|
||||||
|
@ -55,7 +55,7 @@ int main(void)
|
|||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
windows[i] = glfwCreateWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
|
windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, 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",
|
||||||
|
Loading…
Reference in New Issue
Block a user