Game Development Reference
In-Depth Information
with the ID passed to the routine. You can have one- or two-dimensional
texture objects. We make no use of one-dimensional texture objects in
this topic; however, you need to pass two parameters to the glBind-
Textures() function, the first declaring whether the texture object is one- or
glBindTexture operates in one of three ways. The first call using a
texture ID generated by glGenTextures() is to create the object;
subsequent calls make the texture the active texture. The final alternative
is to call glBindTexture with a value of 0. This clears the previously active
A texture object has many parameters other than simply the image
data. The most important of these is the method used to enlarge and to
shrink pixels in an image. The quickest way to enlarge a pixel is to copy
it to more than one pixel on the target screen. The quickest way to shrink
an image into a pixel is to delete unnecessary pixels and just choose the
pixel nearest to the target position. The smoothest way to do this is to
consider surrounding pixels in the calculation and derive a weighted
average of pixels around the target position for shrinking the pixel and
interpolation of surrounding pixels when enlarging. Since we are
concerned with performance we choose the quickest not the smoothest
solution in the examples in this topic.
The other important parameter is how it handles painting the texture if
the calculation tries to look for a pixel outside the width and height of the
bitmap. The choice is to repeat the texture so that it tiles or to clamp the
value of the pixels around the edge of the bitmap. The full list of
parameters stored within a texture object are image data, width, height,
border width and height, internal format, resolution of the components,
minification and magnification filter wrapping modes, border colour and
texture priority. Their values are listed in Table 4.4.
Table 4.4 glTexParameter*() parameters
Parameter name
RGBA component values
[0.0 to 1.0] for current texture object
Search Nedrilad ::

Custom Search