Introducing to OpenGL® API

AutoQ3D was born to design 3D models taking advantage of OpenGL® API libraries to construct all the graphics stuff.  The main objective in mind is to offer a solution to create 3D models with a very intuitive and easy to do things.

OpenGL® API is an application programming interface which allow programmers take advantage of 3D acceleration of video cards and display images; basically it consists of a library of objects and 3D functions. It provides default geometrical figures or shapes called primitives. More complex figures are built up by combining this primitives.


AutoQ3D uses points primitives (GL_POINTS), lines primitives (GL_LINES) and triangles primitives (GL_TRIANGLES).

Basic Geometrical Shapes - Primitives
OpenGL - Basic Geometrical Shapes - Primitives



Concepts to draw objects using OpenGL® API libraries

To draw objects using OpenGL® API libraries the points you use suffer a transformation to display them on the screen.

Transformation process to display OpenGL primitives
Transformation process to display OpenGL primitives

As you see at the figure above, you first specify objects coordinates, then you multiply by the ModelView Matrix where you apply the rotate and transfering functions of the point in the space, then you multiply by the proyection matrix which it adjusts to scale and perspective parameters, then you do a perspective division and another transformation to adjust to the window and finally locate the pixel position on the screen.


Each pixel on the screen has information about
1. RGBA color
2. Depth (called Z-Buffer)
3. Stencil Buffer

"RGB" channel  corresponds to the pixel color and the "A" channel corresponds to the value which you do the source pixel operation and target pixel operation, frequently used for transparency effects.

"Z-Buffer" is used to make depth comparison and to draw or not the pixel, so hiding the objects.



To draw lines you must use parameters like:
1. Position Points
2. Object Color

To draw triangles, besides the above mentioned parameters you use parameters like:
1. Normals
2. Texture coordinates of each vertex

Normals indicates the way the light interacts with the vertex illuminating itself when ponits directly to light.  When the normal of two triangles match we can see the effect show on figure below.

Texture position values
Texture position values


Textures can be loaded from several graphical file formats as JPG, BMP, PNG. You apply the texture coordinate to each vertex. Texture position value is shown on the figure above.

 
RocketTheme Joomla Templates