Talking about OpenGL, OpenGL ES

When drawing this part of the recent studies Android screen, it can be described as brains ... occasionally pointing his family to get a breakthrough on the idea, to achieve the desired function. This article combined basis <OpenGL Programming Guide> Books on a brief OpenGL structure.

OpenGL (Open Graphics Library) Chinese translated as "Open Graphics Library" is a cross-language for rendering 2D, 3D graphics, cross-platform software programming interface. The light version of OpenGL OpenGL ES applications and android, ios and other systems, the hardware layer synthesis technology is OpenGL-based access to the GPU operation. As early as 1992, OpenGL has become the standard image of the industry.

A main operating program for OpenGL rendering images need to be performed as follows:
1. Set the OpenGL geometry from the data used to build a shape;
2. Using different shaders (Shader) primitive calculation is performed on the input data operation, determine their position, color, and other rendering attributes;
3. Finally, the resulting rasterization for each fragment fragment shader execution, and to determine the final color of the location of this fragment;
4. if necessary , but also, for example, determines whether the object corresponding to the fragment is visible for each fragment perform some additional operations, or fragment fused with the color of the current color screen position;

OpenGL is using a client - in the form of server-side implementation, we write the application can be seen as a client, and OpenGL computer graphics hardware vendors provide implementations can be seen as the server. Some implementations of OpenGL (e.g. implement the X Window System) is allowed to run on the server and client computers within a different network. In this case, the client is responsible for submitting OpenGL commands, these commands are then converted to OpenGL window system-related protocols to the server, execute and produce the final image content sharing over the network.

OpenGL, we usually refer to the rendering pipeline, it is a series of data processing, and converts the data to the application's final rendered image. Since the birth of OpenGL, its rendering pipeline has been a very big change happened.

OpenGL is first received geometry data (vertex and geometry) provided by the user, and inputs it to the series of processing the shader stages, comprising: a vertex shader, the colored segments (which itself comprises two shaders), and finally the geometry shader, then it will be fed to a raster unit (rasterizer). Rasterizing unit responsible for generating fragment data of FIG shear in all regions (clipping region) element, and then perform a fragment shader generated for each fragment.

Here Insert Picture Description

Here are some common OpenGL ES API:

glBindFramebuffer ()
The default framebuffer bound to the FBO the FBO bound state to the default state;

glTexImage2D ()
generates a 2D texture specified range (display range of the screen device);

glCopyTexImage2D ()
will be copied to the pixels within the 2D texture buffer range;

glUniform () family of functions
specified variable is an array or Uniform current program objects;

glUniformMatrix () family of functions
designated matrix or matrix array is the current program objects (shader);

glVertexAttribPointer ()
specify the index value of the array index of the vertex attribute when rendering format and location data;

the glViewport ()
in OpenGL display size and position;

glDrawElements ()
to obtain data from the array rendering the primitive. Function call can be drawn by a plurality of smaller geometric primitives;

glFinish ()
will be immediately sent to the command buffer executed by hardware, the hardware needs to wait until the execution is complete before proceeding to down (synchronous mode), is generally used for testing;

glFlush ()
will be immediately sent to the instruction buffer hardware execution, and clears the buffer, the program continues downwardly (asynchronous mode) without waiting for the result.

Published 87 original articles · won praise 195 · views 170 000 +

Guess you like

Origin blog.csdn.net/a29562268/article/details/84570484