Function familiesfamily

glGet*

Read state, limits or results back from OpenGL; the suffix says the type of what comes back.

Signature

void glGet{Integerv|Floatv|Booleanv|Doublev}(GLenum pname, T *data);
void glGet{Shader|Program|QueryObject…}{iv|uiv|fv}(GLuint object, GLenum pname, T *params);

How it works

The getters come in two kinds: global queries (glGetIntegerv(GL_MAX_TEXTURE_SIZE, &n)) and queries about one object (glGetShaderiv(shader, GL_COMPILE_STATUS, &ok)). Strings and errors have their own: glGetString, glGetError.

They are cheap for limits read once at start-up, but can be slow in a frame. Some force the CPU to wait for the GPU (glGetBufferSubData, glGetQueryObject on a fresh query), and even simple ones make the driver synchronise its state. For anything you set yourself, keep your own copy instead of asking.

Reading the name

iv
Integer values through a pointer ("integer vector").
uiv / ui64v
Unsigned 32-bit / 64-bit (timer results need 64).
fv / Booleanv / Doublev
Float, boolean or double values.
InfoLog
A text log (compile and link errors) copied into your char buffer.

Functions in this family

Example

example.cpp
1GLint maxTex = 0;
2glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTex);
3
4GLint ok = 0;
5glGetShaderiv(shader, GL_COMPILE_STATUS, &ok);