Today, I learned about OpenGL state machines and OpenGL attribute pressure stacks.
OpenGL calls various attribute variables the state of pipelines. A state machine is an abstract model and a set of state variables. When a state variable is set, it will remain until the next change.
For example,
Void glable (glenum capability); // enable this type <br/> void gldisable (glenum capability); // disable this type <br/> void glisenable (glenum capability ); // check the status of the VariableVoid glgetbooleanv (glenum pname, glboolean * Params); <br/> void glgetdoublev( glenum pname, gldouble * Params); <br/> void glgetfloatv (glenum pname, glfloat * Params); <br/> void glgetintegerv (glenum pname, glint * Params );OpenGL allows you to apply attribute pressure to a stack. The following function pushes Status values or related values in a set of ranges to void glpushattrib (glbitfield mask) in the attribute stack. The following function extracts the corresponding values.Void glpopattrib (glbitfield mask );
The parameters of these two functions are bit segments, that is, a bit mask. The | symbol or operation is used to represent multiple States. For example, glpushattrib (gl_texture_bit | gl_lighting_bit );
Opegl
First use glenable (gl_line_stipple );
Then, you can use gllinestipple (glint fator, glushort pattern) to create this mode for draw lines.
The pattern parameter indicates a 16-bit value, and each bit indicates whether the line is open. By default, the next bit corresponds to a pixel, and fator increases the width of the mode as a multiplication factor. For example, when fator is 3, each bit represents three pixels. Note that the mode starts with 0th bits (minimum valid bits) and is used to specify a straight line.
Here, starting from the lowest valid bit, it is faster to move OpenGL to the left.