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

@@ -34,33 +34,45 @@
#include <stdio.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
{
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);

View File

@@ -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

View File

@@ -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, &current.redBits);
glGetIntegerv(GL_GREEN_BITS, &current.greenBits);
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",
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);
}