Tuesday, 7 June 2011

Displaying 3D polygon information - APIs Application programming interface

 Application programming interface (API)

An API is a set of rules that allows software to send 3D polygon information to the GPU. If the correct API is used then the GPU is able to display the 3D polygon information, if not then no information is displayed. Two common API's are Direct 3D and OpenGL. 
Direct 3D

Direct 3D is part of Microsoft's Direct X API, It is used to render 3D graphics in applications such as games where performance is important. Direct 3D is the base for the graphics API on the X box consoles.

 This is an screenshot of a game played on the Xbox 360 console. This particular game is called Call of duty and was running on DirectX. This game was displayed using 3D polygon information in the Direct3D API format.


OpenGL is a cross platform programming interface for writing applications that produce 2D and 3D computer graphics. The OpenGL interface can be used to draw complex 3D shapes from simple primitives. OpenGL is mainly used for 3D applications such as the display of graphics in computer animated films, scientific visualisation, virtual reality, flight simulation and computer aided design. As with any API OpenGL renders 3D objects to the screen by providing a set of instructions for exchanging 3D data between applications and graphics cards.

Here is an example of an OpenGL code that describes a cube, and also an image of the cube it describes. The example demonstrates how an OpenGL code allows a cube to be rendered to the screen. The OpenGL code in this example specifies a set of commands that provide a set of rules or instructions for exchanging the 3D data for this cube between the application and the graphics card. The result is that the 3D polygon information for the cube is displayed on the screen. Programmers can use hundreds or thousands of these OpenGL commands to create 3D worlds that can include texture mapping, fog, transparency and lighting effects.

No comments:

Post a Comment