OpenGL Introduction

From LinuxMCE
Revision as of 15:58, 11 August 2007 by Mstovenour (Talk | contribs) (Added to Category: Programmer's Guide)

Jump to: navigation, search


This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.
OpenGL is one API (Application Programming Interface) originally written by SGI that enable using your graphic hardware.

The specifications are defined at the address www.opengl.org The actual implementation match the OpenGL version 1.1 (means that is compatible with most mainstream boards that offer hardware acceleration), but future implementations may not match that compatibility.

OpenGL architecture is in that way:

- OpenGL context is attached with an window (may be any widget) and the programmer then call drawing commands. When they are valid and ready to be drawn they became effective. OpenGL works too as a state machine, which means that at one moment exist only one function and one way to draw. To change it, you must change the current function, OpenGL flags, etc.

- drawing operations are mathematically based, which means that you may translate, rotate, scale using predefined functions. For doing that exist functions as: glTranslate, glRotate, etc. To recover the scale and positions to be defaults, you may call glLoadIdentity()

- OpenGL have more drawing perspectives, but for now the perspective used is orthogonal one (means that even the distance of the object increase, the object will not became smaller)

- OpenGL drawing commands are between glBegin and glEnd, and glBegin gets one parameter that say which mode will be drawn. For instance the mode GL_TRIANGLES will draw one triangle only after three points will be displayed, but GL_TRIANGLESTRIP, the first triangle will be drawn after three points. but the every next point with last two points in the definition of the last drawn triangle will made one new triangle

- current OpenGL implementation use double-buffer and that may mean that until a SwapBuffer command, no result will be shown