glTexGen*() ????????

How do I use glTexGen*() function



Lesson 6 on NeHe site.

Salut Leyder Dylan

je c comment appliquer des textures pis toute le kit… je veux savoir comment utiliser la function glTexGen*() qui sert a generer les coordonner de la texture en passant…


anyone else???

What’s the problem you’re having with it. It’s a straight forward function. You give it 2 paramaters. The first is the number of textures you want it to generate IDs for, the second is a pointer (You do understand pointers, right? If not better get more into C/C++ before you start OpenGL.) to an unsigned int array (or single value if you only need 1). It fills in the array (single value) with a texture ID that is not in use.

glTexGenf() doesnt accept pointer??..

I use it like that:


How do I get the coord back??

Doh! I feel like a complete idiot now. I was thinking glGenTextures… (Well… switch around Tex & Gen and get rid of the ‘ures’ and they are almost the same.)

You can also use glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);

To generate coordinates for environment mapping.

You won’t actually get the coordinates back. OpenGL will automatically generate them for you without having to use the glTexCoord functions. I’m not sure if there is anyway to get them back. If you need the coordinates, you’ll probably have to generate them yourself.

Thank Deiussum