Advertisement

texture coordinates

Started by March 20, 2003 10:06 AM
4 comments, last by paulbird 21 years, 11 months ago
Using the glTexture2D commands over and over again with different bitmaps slows programs down loads. Games such as Tomb Raider put all there textures (32x32 each I think) on a single large bitmap texture whose sides are powers of 2. Then I presume they use texture co-ordinates such as: TexCoord2f(0,0.25);glVertex.... TexCoord2f(0.25,0.25);glVertex.... TexCoord2f(0.25,0);glVertex.... TexCoord2f(0,0);glVertex.... How come it doesn''t work when I try to do it in integer mode? Come to think of it I can''t do colours in integer mode either.
mhmm ... but, what is it ''in integer mode'' ?
Advertisement
why would you need to? you don''t.
You can''t use the integer form of the glTexCoord command to specify a subsection of the texture because a value of 1 is the same as 1.0f under the floating point form.

You can do colour in integer mode, just give the required fraction of the maximum value of the type (i.e. for signed integer a value of 1073741824 is the same as a floating point value of 0.5f (1073741824/2147483647 = 0.5).

Enigma
It does not work in "integer form" because in integer, there is no fractional part. That is, 0.25 is rounded to 0. So, calling :
glTexCoord2i(0, 0.25);
is just the same as calling :
glTexCoord2i(0, 0);

Enigma: I think you''re wrong about texture coordinates. The conversion you''re talking about takes effect with the glColor commands but not with the glTexCoord ones.
quote:
Original post by vincoof
Enigma: I think you''re wrong about texture coordinates. The conversion you''re talking about takes effect with the glColor commands but not with the glTexCoord ones.


That''s what I was trying to say. Sorry if it wasn''t clear.

Enigma

This topic is closed to new replies.

Advertisement