mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Renamed glfwGetWindowParam to glfwGetWindowAttrib.
Parameters are something specified at creation time and are often immutable, while many of the values returned by glfwGetWindowParam reflected current state not controlled by any parameter or hint.
This commit is contained in:
+16
-16
@@ -23,8 +23,8 @@
|
||||
//
|
||||
//========================================================================
|
||||
//
|
||||
// This test creates a windowed mode window with all parameters set to
|
||||
// default values and then reports the actual parameters of the created
|
||||
// This test creates a windowed mode window with all window hints set to
|
||||
// default values and then reports the actual attributes of the created
|
||||
// window and context
|
||||
//
|
||||
//========================================================================
|
||||
@@ -37,18 +37,18 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int param;
|
||||
int attrib;
|
||||
const char* ext;
|
||||
const char* name;
|
||||
} ParamGL;
|
||||
} AttribGL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int param;
|
||||
int attrib;
|
||||
const char* name;
|
||||
} ParamGLFW;
|
||||
} AttribGLFW;
|
||||
|
||||
static ParamGL gl_params[] =
|
||||
static AttribGL gl_attribs[] =
|
||||
{
|
||||
{ GL_RED_BITS, NULL, "red bits" },
|
||||
{ GL_GREEN_BITS, NULL, "green bits" },
|
||||
@@ -61,7 +61,7 @@ static ParamGL gl_params[] =
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
static ParamGLFW glfw_params[] =
|
||||
static AttribGLFW glfw_attribs[] =
|
||||
{
|
||||
{ GLFW_CONTEXT_VERSION_MAJOR, "Context version major" },
|
||||
{ GLFW_CONTEXT_VERSION_MINOR, "Context version minor" },
|
||||
@@ -100,26 +100,26 @@ int main(void)
|
||||
|
||||
printf("window size: %ix%i\n", width, height);
|
||||
|
||||
for (i = 0; glfw_params[i].name; i++)
|
||||
for (i = 0; glfw_attribs[i].name; i++)
|
||||
{
|
||||
printf("%s: %i\n",
|
||||
glfw_params[i].name,
|
||||
glfwGetWindowParam(window, glfw_params[i].param));
|
||||
glfw_attribs[i].name,
|
||||
glfwGetWindowAttrib(window, glfw_attribs[i].attrib));
|
||||
}
|
||||
|
||||
for (i = 0; gl_params[i].name; i++)
|
||||
for (i = 0; gl_attribs[i].name; i++)
|
||||
{
|
||||
GLint value = 0;
|
||||
|
||||
if (gl_params[i].ext)
|
||||
if (gl_attribs[i].ext)
|
||||
{
|
||||
if (!glfwExtensionSupported(gl_params[i].ext))
|
||||
if (!glfwExtensionSupported(gl_attribs[i].ext))
|
||||
continue;
|
||||
}
|
||||
|
||||
glGetIntegerv(gl_params[i].param, &value);
|
||||
glGetIntegerv(gl_attribs[i].attrib, &value);
|
||||
|
||||
printf("%s: %i\n", gl_params[i].name, value);
|
||||
printf("%s: %i\n", gl_attribs[i].name, value);
|
||||
}
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
|
||||
+9
-9
@@ -293,10 +293,10 @@ int main(int argc, char** argv)
|
||||
|
||||
// Report client API version
|
||||
|
||||
api = glfwGetWindowParam(window, GLFW_CLIENT_API);
|
||||
major = glfwGetWindowParam(window, GLFW_CONTEXT_VERSION_MAJOR);
|
||||
minor = glfwGetWindowParam(window, GLFW_CONTEXT_VERSION_MINOR);
|
||||
revision = glfwGetWindowParam(window, GLFW_CONTEXT_REVISION);
|
||||
api = glfwGetWindowAttrib(window, GLFW_CLIENT_API);
|
||||
major = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MAJOR);
|
||||
minor = glfwGetWindowAttrib(window, GLFW_CONTEXT_VERSION_MINOR);
|
||||
revision = glfwGetWindowAttrib(window, GLFW_CONTEXT_REVISION);
|
||||
|
||||
printf("%s context version string: \"%s\"\n",
|
||||
get_client_api_name(api),
|
||||
@@ -325,18 +325,18 @@ int main(int argc, char** argv)
|
||||
|
||||
printf("%s context flags parsed by GLFW:", get_client_api_name(api));
|
||||
|
||||
if (glfwGetWindowParam(window, GLFW_OPENGL_FORWARD_COMPAT))
|
||||
if (glfwGetWindowAttrib(window, GLFW_OPENGL_FORWARD_COMPAT))
|
||||
printf(" forward-compatible");
|
||||
if (glfwGetWindowParam(window, GLFW_OPENGL_DEBUG_CONTEXT))
|
||||
if (glfwGetWindowAttrib(window, GLFW_OPENGL_DEBUG_CONTEXT))
|
||||
printf(" debug");
|
||||
if (glfwGetWindowParam(window, GLFW_CONTEXT_ROBUSTNESS) != GLFW_NO_ROBUSTNESS)
|
||||
if (glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS) != GLFW_NO_ROBUSTNESS)
|
||||
printf(" robustness");
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
if (major > 3 || (major == 3 && minor >= 2))
|
||||
{
|
||||
int profile = glfwGetWindowParam(window, GLFW_OPENGL_PROFILE);
|
||||
int profile = glfwGetWindowAttrib(window, GLFW_OPENGL_PROFILE);
|
||||
|
||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &mask);
|
||||
printf("%s profile mask (0x%08x): %s\n",
|
||||
@@ -360,7 +360,7 @@ int main(int argc, char** argv)
|
||||
strategy,
|
||||
get_strategy_name_gl(strategy));
|
||||
|
||||
robustness = glfwGetWindowParam(window, GLFW_CONTEXT_ROBUSTNESS);
|
||||
robustness = glfwGetWindowAttrib(window, GLFW_CONTEXT_ROBUSTNESS);
|
||||
|
||||
printf("%s robustness strategy parsed by GLFW: %s\n",
|
||||
get_client_api_name(api),
|
||||
|
||||
+2
-2
@@ -143,8 +143,8 @@ int main(int argc, char** argv)
|
||||
glfwSetWindowIconifyCallback(window, window_iconify_callback);
|
||||
|
||||
printf("Window is %s and %s\n",
|
||||
glfwGetWindowParam(window, GLFW_ICONIFIED) ? "iconified" : "restored",
|
||||
glfwGetWindowParam(window, GLFW_FOCUSED) ? "focused" : "defocused");
|
||||
glfwGetWindowAttrib(window, GLFW_ICONIFIED) ? "iconified" : "restored",
|
||||
glfwGetWindowAttrib(window, GLFW_FOCUSED) ? "focused" : "defocused");
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user