Portal:OpenGL Concepts/State: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
State portal page.
 
Clarification.
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
The OpenGL context contains information used by the rendering system. This information is called '''State''', which has given rise to the saying that OpenGL is a "state machine". State, in terms of the basic effect, is really just some value in the OpenGL context. When a context is created, every piece of OpenGL state is initialized to a well-defined default value. Note that this does not mean that a freshly created context can be used to render with without some setup work.
The OpenGL context contains information used by the rendering system. This information is called '''State''', which has given rise to the saying that OpenGL is a "state machine". A piece of state is simply some value stored in the OpenGL context.


OpenGL functions can be grouped into 3 broad categories: functions that set state into the context, functions that query state, and functions that render, given the current state of the context.
Every individual piece of state in the OpenGL context can be uniquely identified. The OpenGL specification document has a massive table at the end, defining what these identifiers are and which state they can be used to query. Not all of the identifiers are as simple as an enumeration, as OpenGL state can be in arrays, where each entry must be queried individually.


Every piece of OpenGL state has some unique identifier, which can be used to later query that piece of state. The OpenGL specification has a massive table at the end, defining what these identifiers are and which state they can be used to query. Not all of the identifiers are as simple as an enumeration, as OpenGL state can be in lists, where each entry must be queried individually.
When a context is created, every piece of state is initialized to a well-defined default value. The state table defines what the initial value is for every piece of OpenGL state. Note that this does not mean that a freshly created context can be used to render with without some setup work.
 
OpenGL functions can be grouped into 3 broad categories: functions that set state into the context, functions that query state, and functions that render given the current state of the context. Functions that query state use the unique identifier to name which state value they retrieve. The state table in the specification says which functions are used to query each state value.

Latest revision as of 21:07, 24 July 2013

The OpenGL context contains information used by the rendering system. This information is called State, which has given rise to the saying that OpenGL is a "state machine". A piece of state is simply some value stored in the OpenGL context.

Every individual piece of state in the OpenGL context can be uniquely identified. The OpenGL specification document has a massive table at the end, defining what these identifiers are and which state they can be used to query. Not all of the identifiers are as simple as an enumeration, as OpenGL state can be in arrays, where each entry must be queried individually.

When a context is created, every piece of state is initialized to a well-defined default value. The state table defines what the initial value is for every piece of OpenGL state. Note that this does not mean that a freshly created context can be used to render with without some setup work.

OpenGL functions can be grouped into 3 broad categories: functions that set state into the context, functions that query state, and functions that render given the current state of the context. Functions that query state use the unique identifier to name which state value they retrieve. The state table in the specification says which functions are used to query each state value.