首页 > 代码库 > OpenGL学习 Introduction
OpenGL学习 Introduction
OpenGL and Graphics Pipeline
The word pipeline is from production lines in factories.Generating a product at high efficiency and volume generally requires two things: scalability and parallelism.While one worker installs the engine in a car, another can be installing the doors and yet another can be installing the wheels.That is parallelism.
Just as a car plant can build multiple cars simultaneously, so can OpenGL break up the work you give it and work on its fundamental elements in parallel.Though a combination of pipelining and parallelism,incredible performance of modern graphics processors is realized.
Current GPUs consist of large number of small programmable processors called shader cores which run mini-programs called shaders. Each core has a relatively low throughput , processing a single instruction of the shader in one or more clock cycles and normally lacking advanced features such as out-of-order execution,branch prediction, super-scalar issue,and together the can perform an immense amount of work.
Figure:
In Figure,the boxes with rounded corners are considered fixed-function stages whereas the boxes with square corners are programmable, which means that they execute shaders that you supply.In practice,some or all of the fixed-function stages may really be implemented in shader code too——it is just that you don’t supply that code, but rather the GPU manufacturer would generally supply it as part of a driver, firmware, or other system software.
The version numbers and dates of publication of 17 editions of the OpenGL specification are shown in follow Table:
OpenGL 4.4 July 2013
OpenGL 4.4 pipeline:
Core Profile OpenGL
In 2008,the ARB fork the OpenGL specification into two profiles.The first is the modern ,core profile ,which remove a number of legacy features leaving only those that are truly accelerated by current graphics hardware.The other is the compatibility profile which maintains backwards compatibility with all revisions of OpenGL back to version 1.0.The core profile is strongly recommended by most OpenGL experts to be the profile that should be used for new application development.
Primitives, Pipelines, and Pixels
The fundamental unit of rendering in OpenGL is known as the primitive.
Primitive A group of one or more vertices formed into a geometric shape by OpenGL such as a line, point, or triangle. All objects and scenes are composed of various combinations of primitives.
Three basic renderable primitive types in OpenGL:
- Points
- Lines
- Triangles
Applications will normally break complex surfaces into a very large number of triangles and send them to OpenGL where they are rendered using a hardware accelerator called a rasterizer.
As polygons, triangles are always convex, and therefore filling rules are easy to devise and follow.
A vertex is simply a point within a coordinate space.
Vertex A single point in space. Except when used for point and line primitives, it also defines the point at which two edges of a polygon meet.
The graphics pipeline is broken down into two major parts:
The first part:
Often known as the front end, processes vertices and primitives, eventually forming them into the points, lines, and triangles that will be handed off to the rasterizer. (primitive assembly)
The second part:
After the rasterizer, the geometry has been converted from what is essentially a vector representation into a large number of independent pixels. These are handed off to the back end, which includes depth and stencil testing, fragment shading, blending, and updating the output image.
OpenGL is really a large collection of fairly simple concepts, built upon each other.
Having a good foundation and big-picture view of the system is essential.
See you later.