OpenGL study Note 1

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.