I dont understand texture coordinates!

  • Follow


Hello!  Subject titles says it all!  I have Ron Fosner's book
"OpenGl: Programming for Win95", and I have even read
many online FAQs, but I'm still not grasping "texture
coordinates".

I understand how to read and select bitmap files for the
texture.  My biggest problem is understanding the
"glTexCoord..()" routine.  Can anybody help me to
understand the meaning of the 1's and 0's??

For example :

  glTexCoord (0.0,  0.0);  // hmmm  0 and 0??
  glVertex (....)

  glTexCoord (1.0,  0.0);  // hmmm  1 and 0??
  glVertex (....)

Ron Fosner's book says the arguments of glTexCoord
are "attached" to the next vertex.  Can anybody clarify
texture coords a bit?

Thanks!

-------
S




0
Reply Shizuka 5/3/2004 5:11:21 AM

Shizuka wrote:

> Ron Fosner's book says the arguments of glTexCoord
> are "attached" to the next vertex.  Can anybody clarify
> texture coords a bit?

A texture is practically picture which is a function over n dimenstions,
mapping every coordinate in a nD coordinate system to a colour. Most common
are 2D pictures but also 1D, 3D are common.

The texture coordinate assigns a position on a picture to the vertices that
are specified.

Wolfgang

0
Reply Wolfgang 5/3/2004 7:14:54 AM


Wolfgang Draxinger <wdraxinger@darkstargames.de> wrote in
news:c74rhh$ek4$1@svr7.m-online.net: 

> The texture coordinate assigns a position on a picture to the vertices
> that are specified.

The thing all people new to textures need to remember is that ALL are in 
the range of 0 to 1 in both directions, no matter how many pixels there 
are. So if you had two textures that showed the same thing except one was 
much bigger, and of a higher quality, saying a coordinate is at .5 in the x 
direction means its at half the width of x, whether the width is 256 pixels 
or 2048. Say you had a quad with texture coordinates at (0,0) (0,.5) 
(.5,.5) & (.5,0). Thats the upper left, upper middle, lower middle, and 
lower right.  That quad will be textured with the upper left quadrant of 
the texture. Draw this out on a piece of paper and you will see.

Check out tutorials at gamedev.net or gametutorials.com for more detailed 
explanations.
0
Reply Theo 5/3/2004 7:38:50 AM

There's some info here, but it's not been updated in a very long time
and there are probably better ways to do it. :)

http://home.clara.net/paulyg/uv.htm

paul

On Sun, 2 May 2004 22:11:21 -0700, "Shizuka" <rman@goodnet.com> wrote:

>Hello!  Subject titles says it all!  I have Ron Fosner's book
>"OpenGl: Programming for Win95", and I have even read
>many online FAQs, but I'm still not grasping "texture
>coordinates".
>
>I understand how to read and select bitmap files for the
>texture.  My biggest problem is understanding the
>"glTexCoord..()" routine.  Can anybody help me to
>understand the meaning of the 1's and 0's??
>
>For example :
>
>  glTexCoord (0.0,  0.0);  // hmmm  0 and 0??
>  glVertex (....)
>
>  glTexCoord (1.0,  0.0);  // hmmm  1 and 0??
>  glVertex (....)
>
>Ron Fosner's book says the arguments of glTexCoord
>are "attached" to the next vertex.  Can anybody clarify
>texture coords a bit?
>
>Thanks!
>
>-------
>S
>
>
>

paul's opengl page    - http://home.clara.net/paulyg
paul's pgp public key - http://home.clara.net/paulyg/PaulGroves.asc
0
Reply paul 5/12/2004 1:11:23 AM

3 Replies
278 Views

(page loaded in 0.069 seconds)

Similiar Articles:













7/25/2012 9:36:34 PM


Reply: