I know how to texture quads and triangle, but how do you texture spheres and teapots (drawn by glut)? Where do you put the texture co-ordinates and how since there are no verteces??
you have 2 options. Either turn on auto texture coord generation (for like sphere mapping) or create your own objects in max or somat, and load them up with their texture coords. And render them yourself.
Ammm, please explain how to turn on auto-texture coord generation, for I have no idea!
First you need to turn on auto texture coord generation.
these can be anywhere. Also use the glDisable with these arguments to turn it off.
Then after binding your texture (probably at texture setup) do this.
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, mode);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, mode);
where mode is one of these.
Use the same one for each GL_S and GL_T.
(As a side note in cube mapping you need to use GL_R too, though using on a GL_TEXTURE_2D, creates an error under my Geforce.)
I’m pretty sure glTexGeni is per texture object. i.e. not an overall state.
For a funky environment mapping effect use SPHERE_MAP
hope that helps!
Nutty can you help me also, i have a similar problem and i dont kow what to do. I have read that you have done a planet system from another reply of yours. Im working on the one from the “Red Book”, added lighting etc but i need to be able to give a colour or texture to the planets, can you suggerst anything or send me somewhere to do it
How are you rendering the planets? Are you useing gluSphere or somat? If so, then to set the color probably do glColor3f(r, g, b);
before calling it.
As for textures, you’ll need someway of specifying the texture coords on the sphere. Usually I scour the net for free models of planets with them already textured and use them!
If ya need more help give me a yell.