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