   Texture projection: defining a custom 'environment map'?
  Hi all,My OpenGL/GLSL programming skills are a bit rusty.  I started a little hobby project to remedy this, but I've run into a problem that I haven't been able to wrap my head around (see below).GoalI want to be able to define the environment map (texture coordinates) used by a projected texture instead of using generated texture coordinates (e.g., GL_EYE_LINEAR).ProblemI don't really know where to start.  I have no problem projecting textures onto a scene (by making use of generated texture coordinates - e.g., GL_EYE_LINEAR), but I don't know how to inject my own environment mapping.  Is this typically done in a vertex shader or what?Any tips/hints/whatever will be appreciated.  Thanks!EditI'm currently looking through the ozone3d.net tutorials and the white paper linked therein.  This may give me a little more insight into how it works.[Edited by - cstdio on January 25, 2010 4:10:59 PM]
  You might want to start by reading the red book...Texture coordinates are passed together with other vertex informations (like vertex coordinates, normals...) :glBegin(GL_TRIANGLES);    glNormal3d(N1[1],N1[2],N1[3]);    glTexCoord2f(T1[1],T1[2]);    glVertex3d(V1[1],V1[2],V1[3]);    glNormal3d(N2[1],N2[2],N2[3]);    glTexCoord2f(T2[1],T2[2]);    glVertex3d(V2[1],V2[2],V2[3]);    glNormal3d(N3[1],N3[2],N3[3]);    glTexCoord2f(T3[1],T3[2]);    glVertex3d(V3[1],V3[2],V3[3]);glEnd();In this example (Delphi), N1,N2,N3 are the normal vectors (3 dims), T1,T2,T3 are the texture coordinates (2 dims) and V1,V2,V3 are the vertex coordinates (3 dims) of each of the triangle's vertices.The vertex coordinates are obviously depending on your model's geometry. HOW the normals and texture coordinates are computed is entirely up to you (not openGL's problem), and that is a very broad subject, especially for textures. If your environment map is a simple projection then it's rather easy : just project the vertex coordinates on a plane or cylinder, for example. In the latter case you will run into the problem of the seam.   