1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-26 20:28:49 -05:00

Removed mirroring of default framebuffer attribs.

This commit is contained in:
Camilla Berglund 2012-08-10 13:03:11 +02:00
parent 3216661da7
commit ddcf5d471e
8 changed files with 67 additions and 98 deletions

View File

@ -390,9 +390,7 @@ extern "C" {
#define GLFW_ICONIFIED 0x00020002 #define GLFW_ICONIFIED 0x00020002
#define GLFW_OPENGL_REVISION 0x00020004 #define GLFW_OPENGL_REVISION 0x00020004
/* The following constants are used for both glfwGetWindowParam /* glfwWindowHint tokens */
* and glfwWindowHint
*/
#define GLFW_RED_BITS 0x00021000 #define GLFW_RED_BITS 0x00021000
#define GLFW_GREEN_BITS 0x00021001 #define GLFW_GREEN_BITS 0x00021001
#define GLFW_BLUE_BITS 0x00021002 #define GLFW_BLUE_BITS 0x00021002
@ -408,6 +406,10 @@ extern "C" {
#define GLFW_STEREO 0x0002100C #define GLFW_STEREO 0x0002100C
#define GLFW_WINDOW_RESIZABLE 0x0002100D #define GLFW_WINDOW_RESIZABLE 0x0002100D
#define GLFW_FSAA_SAMPLES 0x0002100E #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_MAJOR 0x0002100F
#define GLFW_OPENGL_VERSION_MINOR 0x00021010 #define GLFW_OPENGL_VERSION_MINOR 0x00021010
#define GLFW_OPENGL_FORWARD_COMPAT 0x00021011 #define GLFW_OPENGL_FORWARD_COMPAT 0x00021011

View File

@ -320,6 +320,7 @@ version of GLFW.</p>
<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>
<li>Removed default framebuffer attributes from <code>glfwGetWindowParam</code></li>
<li>Bugfix: The default OpenGL version in the <code>glfwinfo</code> test was set to 1.1</li> <li>Bugfix: The default OpenGL version in the <code>glfwinfo</code> test was set to 1.1</li>
<li>Bugfix: The OpenGL profile and forward-compatibility window parameters were not saved after context creation</li> <li>Bugfix: The OpenGL profile and forward-compatibility window parameters were not saved after context creation</li>
<li>Bugfix: The FSAA test did not check for the availability of <code>GL_ARB_multisample</code></li> <li>Bugfix: The FSAA test did not check for the availability of <code>GL_ARB_multisample</code></li>

View File

@ -195,21 +195,6 @@ struct _GLFWwindow
char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1]; char mouseButton[GLFW_MOUSE_BUTTON_LAST + 1];
char key[GLFW_KEY_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 // OpenGL extensions and context attributes
int glMajor, glMinor, glRevision; int glMajor, glMinor, glRevision;
GLboolean glForward, glDebug; GLboolean glForward, glDebug;

View File

@ -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; return GL_TRUE;
} }

View File

@ -662,36 +662,10 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
return window == _glfwLibrary.activeWindow; return window == _glfwLibrary.activeWindow;
case GLFW_ICONIFIED: case GLFW_ICONIFIED:
return window->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: case GLFW_REFRESH_RATE:
return window->refreshRate; return window->refreshRate;
case GLFW_WINDOW_RESIZABLE: case GLFW_WINDOW_RESIZABLE:
return window->resizable; return window->resizable;
case GLFW_FSAA_SAMPLES:
return window->samples;
case GLFW_OPENGL_VERSION_MAJOR: case GLFW_OPENGL_VERSION_MAJOR:
return window->glMajor; return window->glMajor;
case GLFW_OPENGL_VERSION_MINOR: case GLFW_OPENGL_VERSION_MINOR:

View File

@ -34,33 +34,45 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef GL_ARB_multisample
#define GL_SAMPLES_ARB 0x80A9
#endif
typedef struct
{
int param;
char* ext;
char* name;
} ParamGL;
typedef struct typedef struct
{ {
int param; int param;
char* name; 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_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_MAJOR, "OpenGL major" },
{ GLFW_OPENGL_VERSION_MINOR, "OpenGL minor" }, { GLFW_OPENGL_VERSION_MINOR, "OpenGL minor" },
{ GLFW_OPENGL_FORWARD_COMPAT, "OpenGL forward compatible" }, { GLFW_OPENGL_FORWARD_COMPAT, "OpenGL forward compatible" },
{ GLFW_OPENGL_DEBUG_CONTEXT, "OpenGL debug context" }, { GLFW_OPENGL_DEBUG_CONTEXT, "OpenGL debug context" },
{ GLFW_OPENGL_PROFILE, "OpenGL profile" }, { GLFW_OPENGL_PROFILE, "OpenGL profile" },
{ 0, NULL }
}; };
int main(void) int main(void)
@ -87,11 +99,26 @@ int main(void)
printf("window size: %ix%i\n", width, height); 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", printf("%s: %i\n",
parameters[i].name, glfw_params[i].name,
glfwGetWindowParam(window, parameters[i].param)); 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); glfwDestroyWindow(window);

View File

@ -117,7 +117,7 @@ int main(int argc, char** argv)
glfwSwapInterval(1); glfwSwapInterval(1);
samples = glfwGetWindowParam(window, GLFW_FSAA_SAMPLES); glGetIntegerv(GL_SAMPLES_ARB, &samples);
if (samples) if (samples)
printf("Context reports FSAA is available with %i samples\n", samples); printf("Context reports FSAA is available with %i samples\n", samples);
else else

View File

@ -114,7 +114,7 @@ static void list_modes(void)
static void test_modes(void) static void test_modes(void)
{ {
int i, count, width, height; int i, count;
GLFWvidmode* modes = glfwGetVideoModes(&count); GLFWvidmode* modes = glfwGetVideoModes(&count);
glfwSetWindowSizeCallback(window_size_callback); glfwSetWindowSizeCallback(window_size_callback);
@ -124,6 +124,7 @@ static void test_modes(void)
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
GLFWvidmode* mode = modes + i; GLFWvidmode* mode = modes + i;
GLFWvidmode current;
glfwWindowHint(GLFW_RED_BITS, mode->redBits); glfwWindowHint(GLFW_RED_BITS, mode->redBits);
glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits); glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
@ -158,25 +159,25 @@ static void test_modes(void)
} }
} }
if (glfwGetWindowParam(window, GLFW_RED_BITS) != mode->redBits || glGetIntegerv(GL_RED_BITS, &current.redBits);
glfwGetWindowParam(window, GLFW_GREEN_BITS) != mode->greenBits || glGetIntegerv(GL_GREEN_BITS, &current.greenBits);
glfwGetWindowParam(window, GLFW_BLUE_BITS) != mode->blueBits) glGetIntegerv(GL_BLUE_BITS, &current.blueBits);
glfwGetWindowSize(window, &current.width, &current.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", printf("*** Color bit mismatch: (%i %i %i) instead of (%i %i %i)\n",
glfwGetWindowParam(window, GLFW_RED_BITS), current.redBits, current.greenBits, current.blueBits,
glfwGetWindowParam(window, GLFW_GREEN_BITS), mode->redBits, mode->greenBits, mode->blueBits);
glfwGetWindowParam(window, GLFW_BLUE_BITS),
mode->redBits,
mode->greenBits,
mode->blueBits);
} }
glfwGetWindowSize(window, &width, &height); if (current.width != mode->width || current.height != mode->height)
if (width != mode->width || height != mode->height)
{ {
printf("*** Size mismatch: %ix%i instead of %ix%i\n", printf("*** Size mismatch: %ix%i instead of %ix%i\n",
width, height, current.width, current.height,
mode->width, mode->height); mode->width, mode->height);
} }