1. ## glTexCoord and glNormal

Hello. I have some questions that need to be answered. What exactly is the function of glTexCoord and what is the difference between glTexCoord and glNormal?

2. ## Re: glTexCoord and glNormal

glNormal specifies the per-vertex normal vector, which is used in lighting calculation, glTexCoord specifies the per-vertex texture coordinate which is used in texture application (read the corresponding pages from the OpenGL specification). Feel free to ask more specific questions...

3. ## Re: glTexCoord and glNormal

I 've read the corresponding pages in OpenGl specification. What i am trying to do is to create an angular fisheye from a cubemap. So i got the idea to wrap the texture of the cubemap around a sphere and map the texture according to the maths that are applied in order to create the angular fisheye. In order to understand better what i try to do, here is the link:

http://local.wasp.uwa.edu.au/~pbourk...ction/fisheye/

What i do not understand is this: must i ,for each point of the sphere, determine the vector for the mapping by use of glTexcoord? In fact, should i use glTexCoordd at all?

PS: In order to understand, read the the paragraphs "Creating an angular fisheye" and "Inverse transform".

4. ## Re: glTexCoord and glNormal

If I understand that case correctly, normal and texture coordinates equal each other (if you interpret the cubemap as a normal vector lookup table). Still, GL maps texture to a surface using the texture coordinates, so you will have to specify texture coordinates, unless you use shaders and do anything manually anyway.

5. ## Re: glTexCoord and glNormal

(if i remember correctly, with shaders you manipulate directly the GPU "programmable pipeline.) i do not use shaders. i use glNormal3f and when i want to generate texture coordinates, i use these functions:

glTexGenfv(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
glTexGenfv(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
glTexGenfv(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);

What intrigues me in the link that i gave you to look is this:
In the paragraph "Inverse transform", it says that for each unit vector (x,y,z) we find a (u,v) coordinates. I wrote the code for the calculations of (u,v) , given the (x,y,z), and then before calling glVertex i called glTexCoord2f for the (u,v) and from the code above i deleted the first 3 lines. The results was catastrophic to be exact. What could 've gone wrong???

PS: Sorry if i tire you with my questions

6. ## Re: glTexCoord and glNormal

Uhm, TexGen "replaces" manually specified texture coordinates with the generated ones. So when you enable it (with glEnable) then all data you specify with TexCoord is lost. Even so, you don't need to specify texture coordinates if they are generated: what I meant is that you need them for texture mapping, no matter where they come from (manually or generated)!

7. ## Re: glTexCoord and glNormal

what i know that TexGen is used to create "automatically" the texture coordinates using OpenGL's modes. What i do not know (exactly) is how to create manually texture coordinates (in this case the necessary coordinates for fisheye). Something is missing, but i do not know what

8. ## Re: glTexCoord and glNormal

I don't know fisheye projection, but there should be a way to generate these texture coordinates procedurally.
For an arbitrary 3D mesh, texture coordinates are often generated in 3D modelers by artists using projections like: plane, spherical, cylindrical, ... projections.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•