Use Ubuntu to develop OpenGL program 4

Source: Internet
Author: User

The gluinitdisplaymode function. Here I set it to a single buffer.
Fig );
OpenGL has a forward buffer, which may be in the video memory. Setting a single buffer means that only the front buffer is used, and the graphics in the front buffer are drawn to the screen. However, the front buffer does not guarantee that it will be drawn to the screen only after you have drawn a complete image (it does not guarantee the submission of one frame at a time ). Therefore, when you draw an animated image, the intermediate process may also be displayed on the screen, which causes flickering and other strange phenomena.

Therefore, you should use double buffering when drawing an animation. That is to say, our painting is always done on the back buffer. After the painting, we use the function to submit the buffer image to the front buffer.
The specific operation will be explained later when it comes to animation.

In addition, after setting the double buffer, you can switch to the single buffer mode and then switch back. However, if the single buffer mode is set at the beginning, it cannot be changed.
There is a paragraph on the http://www.opengl.org/resources/faq/technical/rasterization.htm:

14.020 how do I change between double-andsingle-buffered mode, in an existing a window?

If you create a single-buffered window, you can't change it.

If you create a double-buffered window, you can treat it as a single-buffered window by setting gldrawbuffer () to gl_front and replacing your swap buffers call with a glflush () call. to switch back to double-buffered, you need to set gldrawbuffer () to gl_back, and call swap buffers at the end of the frame.

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.