Game Development Reference
In-Depth Information
3 Drawing points and
polygons the easy way
with OpenGL
OpenGL is a graphics library that essentially takes lists of vertices in
world space, turns these into polygons and paints them to a 2D buffer
that can be displayed. The library includes the ability to shade and
texture (apply a section of a bitmap to) these polygons. OpenGL can be
used to display transparent polygons and can use fogging to facilitate
distance culling. If distance culling is used without some kind of fogging,
then it can result in an annoying popping on and off for distant objects.
The most important feature of OpenGL is that it uses hardware
wherever possible to speed up processor-intensive operations. Before
you can use OpenGL on a Windows machine you need to set up the
main display window so that it is suitable for OpenGL and direct
OpenGL to use this window for its display. In this chapter we will
concentrate on these set-up procedures and then use this newly
created window to display some very basic geometry. This is probably
the best time to check out the examples for this chapter, which you will
find on the CD in the folder 'Examples\Chapter 03'.
Introducing the OpenGL library
First, let's consider what OpenGL cannot do. The standard library
contains no methods for creating complex geometry or importing models
from leading CGI packages such as 3Dstudio Max or Lightwave 3D. That
is not to say that you cannot use OpenGL to display such content, you
can, but preparing the content in a way that is suitable for OpenGL will be
your job as a developer. OpenGL is designed to take a vertex list, turn this
into shaded and textured polygons, and rasterize (convert to a 2D screen
buffer) the result suitable for display on the computer screen. The basic
OpenGL library contains no hardware-specific window commands. It
deals exclusively with a hidden off-screen buffer. The display of this buffer
is where operating system-specific code is used. In this topic we are only
Search Nedrilad ::

Custom Search