1.2 OpenGLArchitecture
OpenGL supports multiple platforms, including Windows , liunx , and MACOs and UNIX . If the application Program does not use a large number of OS-related calls, therefore, porting the OpenGL program between different platforms is quite simple. Windows has an absolute advantage in the desktop operating system. therefore, the winodows application that develops OpenGL is still our first choice.
InWindowsIn the application,OpenGLImplementation andGDI,DirectXAre different,GDIYesdisplay Device InterfaceDisplay Device InterfaceThe graphics card driver interacts with the graphics card hardware.DirectXAttackers can bypass the driver and directly deal with the hardware through the hardware abstraction layer or hardware simulation layer.OpenGLThen3DDevice Driver Interface3ddiAnd then access the hardware through the driver provided by the video card manufacturer,1-1.
Figure1-1The three graphic interfaces areWindowsImplementation on
BecauseOpenGLYes3DThe underlying graphics library of the image does not provide ry elements and cannot be used directly to describe the Rendering scenario. A typicalOpenGLThe main steps for applications to display images on the screen are as follows:
Construct geometric elements (points, lines, surfaces, polygon, bitmap, etc.) and create mathematical descriptions of objects;
In3DPlace objects in the space and select an appropriate observation point;
Converts the mathematical description and color information of an object into pixels on the screen;
Perform raster After texture ing of pixel or object data;
Perform operations on the object fragment after the grating and send it to the frame buffer;
Display the image on the screen.
Figure1-2YesOpenGLThe entire rendering process, some of which will be detailed in subsequent chapters.
Figure1-2 OpenGLRendering process