OpenGL basic graphics programming-OpenGL concept Creation

Source: Internet
Author: User
2.1 basic understanding of OpenGL
OpenGL is a software interface with a hardware Graphics Generator. It includes more than 100 graphic operation functions. developers can use these functions to construct scene models and develop 3D graphics interaction software. As described in the previous chapter, OpenGL is a high-performance graphics development software package. OpenGL supports networks. In the network system, you can run program display graphics on different graphics terminals. OpenGL, as a graphical interface independent from hardware, does not provide device operation functions closely related to hardware, it also does not provide graphical operation functions that describe complex shapes such as airplanes, automobiles, and molecules. You must construct your own 3D model from the basic graphic units such as points, lines, and surfaces. Of course, more advanced OpenGL-based 3D graphics modeling development software packages like openinventor will provide convenient tools. Therefore, OpenGL's graphic operation functions are very basic and flexible. For example, OpenGL provides a variety of Modeling Processes and rich content. OpenGL provides the following ways to draw 3D objects:

  • Gridline Drawing Method(Wireframe)
    In this way, only the mesh contour of a three-dimensional object is drawn.
  • Drawing of depth-first gridlines(Depth_cued)
    Drawing with gridlines, adding a simulated human eye object is the same. Objects in the distance are darker than objects in the near corner.
  • Grid line Plotting Method(Antialiased)
    Use gridlines to draw images. Use reverse sampling to reduce the variation of the drawing lines.
  • Plane blanking drawing method(Flat_shade)
    The hidden surface of the model is reduced, and the plane unit of the model is colored according to the illumination level, but not smooth.
  • Smooth and invisible Drawing Method(Smooth_shade)
    This method is closer to reality.
  • Plotting Method with shadow and texture added(Shadows, textures)
    Pasting textures on the model surface or even adding light shadows makes the 3D landscape look like a photo.
  • Drawing Method of motion blur(Motion-blured)
    Simulate the motion of an object.
  • Atmospheric Effect(Atmosphere-effects)
    Add atmosphere effects such as fog to 3D landscapes to bring people into reality.
  • Deep domain Effect(Depth-of-effects)
    Similar to the camera lens effect, the model is clear at the focal point, and vice versa.

These 3D object plotting and special effect processing methods show that OpenGL has been able to simulate complex 3D objects or natural landscapes. This is what we are facing with OpenGL.

2.2 OpenGL Workflow
The basic workflow of OpenGL is as follows:

The geometric vertex data includes the vertex set, line set, and polygon set of the model. The data goes through the upper part of the flowchart, including the vertex generator and vertex-by-vertex operations; image Data includes pixel sets, image sets, and map sets. The processing method of image pixel data is different from that of geometric vertex data, however, they are all rasterized and processed individually by fragment until the final grating data is written into the frame buffer. All data in OpenGL, including geometric vertex data and pixel data, can be stored in the display list or processed immediately. In OpenGL, the display list technology is an important technology.
OpenGL requires that all geometric units be described by vertices. In this way, the Attention generator and vertex-by-vertex computing operations can calculate and operate on each vertex, and then raster to form graphical fragments; for pixel data, the pixel operation results are stored in the memory used for texture assembly, and then rastered like the geometric vertex operation to form the graphic element.
At the end of the entire process, the graphic element must perform a series of operations one by one, so that the final pixel value BZ is sent to the frame buffer to display the image.

2.3 OpenGL graphic operation steps
The basic workflow of OpenGL is described in the previous section. Based on this process, we can summarize the basic steps for the main graphic operations in OpenGL until the 3D graphic landscape is rendered on the computer screen:
1) create a scene model based on the basic graphics unit and perform a mathematical description of the model (in OpenGL, points, lines, polygon, images, and bitmaps are used as the basic graphics unit ).
2) Place the scene model in a proper position in the 3D space and set the viewpoint (viewpoint) to observe the landscape of interest.
3) Calculate the colors of all objects in the model. The colors are determined based on application requirements, and the lighting conditions and texture pasting methods are also determined.
4) converts the mathematical description and color information of the scene model to the pixels on the computer screen. This process is also called Rasterization ).
During the execution of these steps, OpenGL may execute other operations, such as automatic blanking. In addition, you can perform operations based on object prime data before the scenes are raster and sent to the frame buffer.
 

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.