Game Development Reference
In-Depth Information
eighth of the pixels across and an eighth of the pixels down. If it is
important that the image still looks like the original, then as a developer
you have a choice, you can sacrifice performance and use filtering to
create the shrunken image, or you can pre-filter a set of bitmaps and use
the most appropriately sized image from the pre-filtered set. This is what
mipmaps are about. They are created once using filtering techniques then
OpenGL uses the best size image from the set when it is drawing the
display. The GLU library has a function call that makes creating mipmaps
as easy as creating a single texture. Use
int gluBuild2DMipmaps (Glenum target , Glint internalFormat , Glsizei
width , Glsizei height , Glint border , Glenum
format , Glenum type , const Glvoid *pixels );
instead of glTexImage2D when creating the texture object and all the
levels of detail will be automatically created. OpenGL will know which
bitmap level to use and as a developer you use the texture object in the
same way as one with a single level. If you want more control then you
can create your own mipmaps using multiple calls to glTexImage2D with
different levels set.
So there we are, lights and textures, our armoury is complete. In the last
two chapters we have breezed through an introduction to OpenGL. If you
intend to develop your own engine then this should provide the
foundation. With space at a premium I have only included those parts of
OpenGL that we are going to use extensively in later chapters. Take a
look at the bibliography to see where to go for further information on using
OpenGL in different ways. The next thing we need is some geometry so
that we can start to create interesting real-time animations.
Search Nedrilad ::

Custom Search