mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Moved bits parameters from glfwOpenWindow to glfwOpenWindowHint.
This commit is contained in:
parent
5fd3fc71de
commit
950a3beda2
@ -574,7 +574,9 @@ int main( void )
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
GLFWwindow window = glfwOpenWindow( 400,400, 0,0,0,0, 16,0, GLFW_WINDOW );
|
||||
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
GLFWwindow window = glfwOpenWindow( 400, 400, GLFW_WINDOW );
|
||||
if (!window)
|
||||
{
|
||||
fprintf( stderr, "Failed to open GLFW window\n" );
|
||||
|
@ -329,7 +329,9 @@ int main(int argc, char *argv[])
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
window = glfwOpenWindow( 300,300, 0,0,0,0, 16,0, GLFW_WINDOW );
|
||||
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
window = glfwOpenWindow( 300, 300, GLFW_WINDOW );
|
||||
if (!window)
|
||||
{
|
||||
fprintf( stderr, "Failed to open GLFW window\n" );
|
||||
|
@ -457,8 +457,10 @@ int main( void )
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
// Open OpenGL window
|
||||
window = glfwOpenWindow( 500, 500, 0,0,0,0, 16,0, GLFW_WINDOW );
|
||||
window = glfwOpenWindow( 500, 500, GLFW_WINDOW );
|
||||
if (!window)
|
||||
{
|
||||
fprintf( stderr, "Failed to open GLFW window\n" );
|
||||
|
@ -23,7 +23,7 @@ int main( void )
|
||||
}
|
||||
|
||||
// Open a window and create its OpenGL context
|
||||
window = glfwOpenWindow( 640, 480, 0,0,0,0, 0,0, GLFW_WINDOW );
|
||||
window = glfwOpenWindow( 640, 480, GLFW_WINDOW );
|
||||
if (!window)
|
||||
{
|
||||
fprintf( stderr, "Failed to open GLFW window\n" );
|
||||
|
@ -334,8 +334,10 @@ int main(int argc, char* argv[])
|
||||
height = 480;
|
||||
mode = GLFW_WINDOW;
|
||||
|
||||
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
/* Open window */
|
||||
window = glfwOpenWindow(width,height,0,0,0,0,16,0,mode);
|
||||
window = glfwOpenWindow(width,height,mode);
|
||||
if (!window)
|
||||
{
|
||||
fprintf(stderr, "Could not open window\n");
|
||||
|
@ -309,16 +309,16 @@ extern "C" {
|
||||
#define GLFW_ACTIVE 0x00020002
|
||||
#define GLFW_ICONIFIED 0x00020003
|
||||
#define GLFW_ACCELERATED 0x00020004
|
||||
|
||||
/* The following constants are used for both glfwGetWindowParam
|
||||
* and glfwOpenWindowHint
|
||||
*/
|
||||
#define GLFW_RED_BITS 0x00020005
|
||||
#define GLFW_GREEN_BITS 0x00020006
|
||||
#define GLFW_BLUE_BITS 0x00020007
|
||||
#define GLFW_ALPHA_BITS 0x00020008
|
||||
#define GLFW_DEPTH_BITS 0x00020009
|
||||
#define GLFW_STENCIL_BITS 0x0002000A
|
||||
|
||||
/* The following constants are used for both glfwGetWindowParam
|
||||
* and glfwOpenWindowHint
|
||||
*/
|
||||
#define GLFW_REFRESH_RATE 0x0002000B
|
||||
#define GLFW_ACCUM_RED_BITS 0x0002000C
|
||||
#define GLFW_ACCUM_GREEN_BITS 0x0002000D
|
||||
@ -392,7 +392,7 @@ GLFWAPI int glfwGetVideoModes(GLFWvidmode* list, int maxcount);
|
||||
GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode);
|
||||
|
||||
/* Window handling */
|
||||
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode);
|
||||
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int mode);
|
||||
GLFWAPI void glfwOpenWindowHint(int target, int hint);
|
||||
GLFWAPI void glfwMakeWindowCurrent(GLFWwindow window);
|
||||
GLFWAPI int glfwIsWindow(GLFWwindow window);
|
||||
|
@ -66,6 +66,12 @@
|
||||
// parameters passed to us by glfwOpenWindowHint
|
||||
//------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
int redBits;
|
||||
int greenBits;
|
||||
int blueBits;
|
||||
int alphaBits;
|
||||
int depthBits;
|
||||
int stencilBits;
|
||||
int refreshRate;
|
||||
int accumRedBits;
|
||||
int accumGreenBits;
|
||||
|
35
lib/window.c
35
lib/window.c
@ -365,10 +365,7 @@ const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
|
||||
// Create the GLFW window and its associated context
|
||||
//========================================================================
|
||||
|
||||
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
|
||||
int redbits, int greenbits, int bluebits,
|
||||
int alphabits, int depthbits, int stencilbits,
|
||||
int mode)
|
||||
GLFWAPI GLFWwindow glfwOpenWindow(int width, int height, int mode)
|
||||
{
|
||||
_GLFWfbconfig fbconfig;
|
||||
_GLFWwndconfig wndconfig;
|
||||
@ -386,12 +383,12 @@ GLFWAPI GLFWwindow glfwOpenWindow(int width, int height,
|
||||
memset(window, 0, sizeof(_GLFWwindow));
|
||||
|
||||
// Set up desired framebuffer config
|
||||
fbconfig.redBits = Max(redbits, 0);
|
||||
fbconfig.greenBits = Max(greenbits, 0);
|
||||
fbconfig.blueBits = Max(bluebits, 0);
|
||||
fbconfig.alphaBits = Max(alphabits, 0);
|
||||
fbconfig.depthBits = Max(depthbits, 0);
|
||||
fbconfig.stencilBits = Max(stencilbits, 0);
|
||||
fbconfig.redBits = Max(_glfwLibrary.hints.redBits, 0);
|
||||
fbconfig.greenBits = Max(_glfwLibrary.hints.greenBits, 0);
|
||||
fbconfig.blueBits = Max(_glfwLibrary.hints.blueBits, 0);
|
||||
fbconfig.alphaBits = Max(_glfwLibrary.hints.alphaBits, 0);
|
||||
fbconfig.depthBits = Max(_glfwLibrary.hints.depthBits, 0);
|
||||
fbconfig.stencilBits = Max(_glfwLibrary.hints.stencilBits, 0);
|
||||
fbconfig.accumRedBits = Max(_glfwLibrary.hints.accumRedBits, 0);
|
||||
fbconfig.accumGreenBits = Max(_glfwLibrary.hints.accumGreenBits, 0);
|
||||
fbconfig.accumBlueBits = Max(_glfwLibrary.hints.accumBlueBits, 0);
|
||||
@ -572,6 +569,24 @@ GLFWAPI void glfwOpenWindowHint(int target, int hint)
|
||||
|
||||
switch (target)
|
||||
{
|
||||
case GLFW_RED_BITS:
|
||||
_glfwLibrary.hints.redBits = hint;
|
||||
break;
|
||||
case GLFW_GREEN_BITS:
|
||||
_glfwLibrary.hints.greenBits = hint;
|
||||
break;
|
||||
case GLFW_BLUE_BITS:
|
||||
_glfwLibrary.hints.blueBits = hint;
|
||||
break;
|
||||
case GLFW_ALPHA_BITS:
|
||||
_glfwLibrary.hints.alphaBits = hint;
|
||||
break;
|
||||
case GLFW_DEPTH_BITS:
|
||||
_glfwLibrary.hints.depthBits = hint;
|
||||
break;
|
||||
case GLFW_STENCIL_BITS:
|
||||
_glfwLibrary.hints.stencilBits = hint;
|
||||
break;
|
||||
case GLFW_REFRESH_RATE:
|
||||
_glfwLibrary.hints.refreshRate = hint;
|
||||
break;
|
||||
|
@ -65,7 +65,7 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwOpenWindow(window_width, window_height, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
|
||||
window = glfwOpenWindow(window_width, window_height, GLFW_WINDOW);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
@ -75,7 +75,7 @@ int main(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
window = glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
|
||||
window = glfwOpenWindow(0, 0, GLFW_WINDOW);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
@ -274,7 +274,7 @@ int main(void)
|
||||
|
||||
printf("Library initialized\n");
|
||||
|
||||
window = glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
|
||||
window = glfwOpenWindow(0, 0, GLFW_WINDOW);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
@ -55,7 +55,7 @@ int main(void)
|
||||
|
||||
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
|
||||
|
||||
window = glfwOpenWindow(400, 400, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
|
||||
window = glfwOpenWindow(400, 400, GLFW_WINDOW);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
@ -89,7 +89,7 @@ static GLboolean open_window(void)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
window_handle = glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
|
||||
window_handle = glfwOpenWindow(0, 0, GLFW_WINDOW);
|
||||
if (!window_handle)
|
||||
return GL_FALSE;
|
||||
|
||||
|
@ -84,7 +84,9 @@ static int open_window(int width, int height, int mode)
|
||||
{
|
||||
double base = glfwGetTime();
|
||||
|
||||
window_handle = glfwOpenWindow(width, height, 0, 0, 0, 0, 16, 0, mode);
|
||||
glfwOpenWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
window_handle = glfwOpenWindow(width, height, mode);
|
||||
if (!window_handle)
|
||||
{
|
||||
fprintf(stderr, "Failed to create %s mode GLFW window\n", get_mode_name(mode));
|
||||
|
@ -50,7 +50,7 @@ int main(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
window = glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW);
|
||||
window = glfwOpenWindow(0, 0, GLFW_WINDOW);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
@ -183,7 +183,7 @@ int main(int argc, char** argv)
|
||||
// We assume here that we stand a better chance of success by leaving all
|
||||
// possible details of pixel format selection to GLFW
|
||||
|
||||
if (!glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW))
|
||||
if (!glfwOpenWindow(0, 0, GLFW_WINDOW))
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user