diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 718391cb..45dd1aad 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -390,9 +390,7 @@ extern "C" { #define GLFW_ICONIFIED 0x00020002 #define GLFW_OPENGL_REVISION 0x00020004 -/* The following constants are used for both glfwGetWindowParam - * and glfwWindowHint - */ +/* glfwWindowHint tokens */ #define GLFW_RED_BITS 0x00021000 #define GLFW_GREEN_BITS 0x00021001 #define GLFW_BLUE_BITS 0x00021002 @@ -408,6 +406,10 @@ extern "C" { #define GLFW_STEREO 0x0002100C #define GLFW_WINDOW_RESIZABLE 0x0002100D #define GLFW_FSAA_SAMPLES 0x0002100E + +/* The following constants are used with both glfwGetWindowParam + * and glfwWindowHint + */ #define GLFW_OPENGL_VERSION_MAJOR 0x0002100F #define GLFW_OPENGL_VERSION_MINOR 0x00021010 #define GLFW_OPENGL_FORWARD_COMPAT 0x00021011 diff --git a/readme.html b/readme.html index 8bf5d046..b93b7c6b 100644 --- a/readme.html +++ b/readme.html @@ -320,6 +320,7 @@ version of GLFW.

  • Removed nonsensical key actions for Unicode character input
  • Removed GLFWCALL and GLFWAPIENTRY macros for stdcall calling convention
  • Removed GLFW_ACCELERATED window parameter
  • +
  • Removed default framebuffer attributes from glfwGetWindowParam
  • Bugfix: The default OpenGL version in the glfwinfo test was set to 1.1
  • Bugfix: The OpenGL profile and forward-compatibility window parameters were not saved after context creation
  • Bugfix: The FSAA test did not check for the availability of GL_ARB_multisample
  • diff --git a/src/internal.h b/src/internal.h index 1e4825c0..982d868c 100644 --- a/src/internal.h +++ b/src/internal.h @@ -195,21 +195,6 @@ struct _GLFWwindow char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1]; char key[GLFW_KEY_LAST + 1]; - // Framebuffer attributes - GLint redBits; - GLint greenBits; - GLint blueBits; - GLint alphaBits; - GLint depthBits; - GLint stencilBits; - GLint accumRedBits; - GLint accumGreenBits; - GLint accumBlueBits; - GLint accumAlphaBits; - GLint auxBuffers; - GLboolean stereo; - GLint samples; - // OpenGL extensions and context attributes int glMajor, glMinor, glRevision; GLboolean glForward, glDebug; diff --git a/src/opengl.c b/src/opengl.c index 19c07253..67c6f414 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -406,27 +406,6 @@ GLboolean _glfwRefreshContextParams(void) } } - glGetIntegerv(GL_RED_BITS, &window->redBits); - glGetIntegerv(GL_GREEN_BITS, &window->greenBits); - glGetIntegerv(GL_BLUE_BITS, &window->blueBits); - - glGetIntegerv(GL_ALPHA_BITS, &window->alphaBits); - glGetIntegerv(GL_DEPTH_BITS, &window->depthBits); - glGetIntegerv(GL_STENCIL_BITS, &window->stencilBits); - - glGetIntegerv(GL_ACCUM_RED_BITS, &window->accumRedBits); - glGetIntegerv(GL_ACCUM_GREEN_BITS, &window->accumGreenBits); - glGetIntegerv(GL_ACCUM_BLUE_BITS, &window->accumBlueBits); - glGetIntegerv(GL_ACCUM_ALPHA_BITS, &window->accumAlphaBits); - - glGetIntegerv(GL_AUX_BUFFERS, &window->auxBuffers); - glGetBooleanv(GL_STEREO, &window->stereo); - - if (glfwExtensionSupported("GL_ARB_multisample")) - glGetIntegerv(GL_SAMPLES_ARB, &window->samples); - else - window->samples = 0; - return GL_TRUE; } diff --git a/src/window.c b/src/window.c index f281a256..5fc2b32f 100644 --- a/src/window.c +++ b/src/window.c @@ -662,36 +662,10 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param) return window == _glfwLibrary.activeWindow; case GLFW_ICONIFIED: return window->iconified; - case GLFW_RED_BITS: - return window->redBits; - case GLFW_GREEN_BITS: - return window->greenBits; - case GLFW_BLUE_BITS: - return window->blueBits; - case GLFW_ALPHA_BITS: - return window->alphaBits; - case GLFW_DEPTH_BITS: - return window->depthBits; - case GLFW_STENCIL_BITS: - return window->stencilBits; - case GLFW_ACCUM_RED_BITS: - return window->accumRedBits; - case GLFW_ACCUM_GREEN_BITS: - return window->accumGreenBits; - case GLFW_ACCUM_BLUE_BITS: - return window->accumBlueBits; - case GLFW_ACCUM_ALPHA_BITS: - return window->accumAlphaBits; - case GLFW_AUX_BUFFERS: - return window->auxBuffers; - case GLFW_STEREO: - return window->stereo; case GLFW_REFRESH_RATE: return window->refreshRate; case GLFW_WINDOW_RESIZABLE: return window->resizable; - case GLFW_FSAA_SAMPLES: - return window->samples; case GLFW_OPENGL_VERSION_MAJOR: return window->glMajor; case GLFW_OPENGL_VERSION_MINOR: diff --git a/tests/defaults.c b/tests/defaults.c index 289e2c60..fc7b96cc 100644 --- a/tests/defaults.c +++ b/tests/defaults.c @@ -34,33 +34,45 @@ #include #include +#ifndef GL_ARB_multisample + #define GL_SAMPLES_ARB 0x80A9 +#endif + +typedef struct +{ + int param; + char* ext; + char* name; +} ParamGL; + typedef struct { int param; char* name; -} Param; +} ParamGLFW; -static Param parameters[] = +static ParamGL gl_params[] = +{ + { GL_RED_BITS, NULL, "red bits" }, + { GL_GREEN_BITS, NULL, "green bits" }, + { GL_BLUE_BITS, NULL, "blue bits" }, + { GL_ALPHA_BITS, NULL, "alpha bits" }, + { GL_DEPTH_BITS, NULL, "depth bits" }, + { GL_STENCIL_BITS, NULL, "stencil bits" }, + { GL_STEREO, NULL, "stereo" }, + { GL_SAMPLES_ARB, "GL_ARB_multisample", "FSAA samples" }, + { 0, NULL, NULL } +}; + +static ParamGLFW glfw_params[] = { - { GLFW_RED_BITS, "red bits" }, - { GLFW_GREEN_BITS, "green bits" }, - { GLFW_BLUE_BITS, "blue bits" }, - { GLFW_ALPHA_BITS, "alpha bits" }, - { GLFW_DEPTH_BITS, "depth bits" }, - { GLFW_STENCIL_BITS, "stencil bits" }, { GLFW_REFRESH_RATE, "refresh rate" }, - { GLFW_ACCUM_RED_BITS, "accum red bits" }, - { GLFW_ACCUM_GREEN_BITS, "accum green bits" }, - { GLFW_ACCUM_BLUE_BITS, "accum blue bits" }, - { GLFW_ACCUM_ALPHA_BITS, "accum alpha bits" }, - { GLFW_AUX_BUFFERS, "aux buffers" }, - { GLFW_STEREO, "stereo" }, - { GLFW_FSAA_SAMPLES, "FSAA samples" }, { GLFW_OPENGL_VERSION_MAJOR, "OpenGL major" }, { GLFW_OPENGL_VERSION_MINOR, "OpenGL minor" }, { GLFW_OPENGL_FORWARD_COMPAT, "OpenGL forward compatible" }, { GLFW_OPENGL_DEBUG_CONTEXT, "OpenGL debug context" }, { GLFW_OPENGL_PROFILE, "OpenGL profile" }, + { 0, NULL } }; int main(void) @@ -87,11 +99,26 @@ int main(void) printf("window size: %ix%i\n", width, height); - for (i = 0; (size_t) i < sizeof(parameters) / sizeof(parameters[0]); i++) + for (i = 0; glfw_params[i].name; i++) { printf("%s: %i\n", - parameters[i].name, - glfwGetWindowParam(window, parameters[i].param)); + glfw_params[i].name, + glfwGetWindowParam(window, glfw_params[i].param)); + } + + for (i = 0; gl_params[i].name; i++) + { + GLint value = 0; + + if (gl_params[i].ext) + { + if (!glfwExtensionSupported(gl_params[i].ext)) + continue; + } + + glGetIntegerv(gl_params[i].param, &value); + + printf("%s: %i\n", gl_params[i].name, value); } glfwDestroyWindow(window); diff --git a/tests/fsaa.c b/tests/fsaa.c index e2e0623c..93377b59 100644 --- a/tests/fsaa.c +++ b/tests/fsaa.c @@ -117,7 +117,7 @@ int main(int argc, char** argv) glfwSwapInterval(1); - samples = glfwGetWindowParam(window, GLFW_FSAA_SAMPLES); + glGetIntegerv(GL_SAMPLES_ARB, &samples); if (samples) printf("Context reports FSAA is available with %i samples\n", samples); else diff --git a/tests/modes.c b/tests/modes.c index eeb83abf..2293a399 100644 --- a/tests/modes.c +++ b/tests/modes.c @@ -114,7 +114,7 @@ static void list_modes(void) static void test_modes(void) { - int i, count, width, height; + int i, count; GLFWvidmode* modes = glfwGetVideoModes(&count); glfwSetWindowSizeCallback(window_size_callback); @@ -124,6 +124,7 @@ static void test_modes(void) for (i = 0; i < count; i++) { GLFWvidmode* mode = modes + i; + GLFWvidmode current; glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); @@ -158,25 +159,25 @@ static void test_modes(void) } } - if (glfwGetWindowParam(window, GLFW_RED_BITS) != mode->redBits || - glfwGetWindowParam(window, GLFW_GREEN_BITS) != mode->greenBits || - glfwGetWindowParam(window, GLFW_BLUE_BITS) != mode->blueBits) + glGetIntegerv(GL_RED_BITS, ¤t.redBits); + glGetIntegerv(GL_GREEN_BITS, ¤t.greenBits); + glGetIntegerv(GL_BLUE_BITS, ¤t.blueBits); + + glfwGetWindowSize(window, ¤t.width, ¤t.height); + + if (current.redBits != mode->redBits || + current.greenBits != mode->greenBits || + current.blueBits != mode->blueBits) { printf("*** Color bit mismatch: (%i %i %i) instead of (%i %i %i)\n", - glfwGetWindowParam(window, GLFW_RED_BITS), - glfwGetWindowParam(window, GLFW_GREEN_BITS), - glfwGetWindowParam(window, GLFW_BLUE_BITS), - mode->redBits, - mode->greenBits, - mode->blueBits); + current.redBits, current.greenBits, current.blueBits, + mode->redBits, mode->greenBits, mode->blueBits); } - glfwGetWindowSize(window, &width, &height); - - if (width != mode->width || height != mode->height) + if (current.width != mode->width || current.height != mode->height) { printf("*** Size mismatch: %ix%i instead of %ix%i\n", - width, height, + current.width, current.height, mode->width, mode->height); }