TextureMapping Confusion

Hello there!
I have a little confusion with my texturemapping.

  1. When exactly should I use my functions?
    (such as glTexCoord2f(…)
  2. How does a cube know that I wanna draw him, using a specific texture, after defining a lot? Is there some “choose”-command like with glColor3f(r,g,b) so that the cube knows that?
  3. Is is possible (and/or reasonable) to put all those functions, headers, definitions and variables into an external class in a headerfile and just call those functions then? If yes… what exactly would it look like?

Thank you so much,
Fabian

Originally posted by fabianspring:
[b]Hello there!
I have a little confusion with my texturemapping.

  1. When exactly should I use my functions?
    (such as glTexCoord2f(…)
  2. How does a cube know that I wanna draw him, using a specific texture, after defining a lot? Is there some “choose”-command like with glColor3f(r,g,b) so that the cube knows that?
  3. Is is possible (and/or reasonable) to put all those functions, headers, definitions and variables into an external class in a headerfile and just call those functions then? If yes… what exactly would it look like?

Thank you so much,
Fabian[/b]

Jeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeezzzz!

I’ll try and help some - “after defining a lot” - I assume you mean after loading your texture and binding it - then you `use’ the texture by executing something like glBindTexture ( myTextureId ); where myTextureId is the Id you used for glGenTextures when you bound them in the first instance.

If you use display lists, you can compile your cube and then execute it like this:

glBindTexture ( myTextureId);
glCallList ( myDisplayListId );

In your display list, you perform the actions you suggested above:

glVertex…
glColor…
glTex…

etc.

NOW its important to research and read up on these things. Try NEHE developer tutorials - they take you right from the start and are enormously good.