Create OpenGL render context in OpenGL.

Source: Internet
Author: User

OpenGL is a graphics library based on customer/server and pipeline. That is, an applicationProgram(Customer) writes various commands and data to the pipeline. This command and data will be temporarily saved, and the graphics library (server) will not start to process them until it receives a special command, and send the processing result to the user through a pipeline.
Therefore, the basic structure of the OpenGL application is:

Create MPs queue

Write Data and commands to pipelines as needed

Close MPs queue

In Windows 95/NT, this pipeline is the OpenGL rendering environment-RC for short. Therefore, creating an MPS queue is actually obtaining an available rc.

In Windows's GDI system, graphical display is performed through the graphical device context (DC. So the RC is:

① Obtain a DC first,

② Adjust the pixel format (pixelformat) of the DC for the OpenGL library to draw,

③ Use DC to call wglcreatecontext (HDC) to create an RC,

④ Call wglmakecurrent (HRC, HDC) to specify the established RC as the current RC.

You can delete an RC when it is no longer used. The method is as follows:

Make RC not "Current RC ":

Wglmakecurrent (HDC, null); // no longer has the current RC

Wgldeletecontent (HRC); // delete it

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.