• Advertisement
Sign in to follow this  

Texture coordinates?

This topic is 4175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I've found a shadowmap-tutorial on the internet which includes these lines: genS[0] = 1.0f; genS[1]=genS[2]=genS[3]=0.0f; genT[1] = 1.0f; genT[0]=genT[2]=genT[3]=0.0f; genR[2] = 1.0f; genR[0] = genR[1] = genR[3] = 0.0f; genQ[3] = 1.0f; genQ[0]=genQ[1]=genQ[2]=0.0f; glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR ); glTexGenfv( GL_S, GL_EYE_PLANE, genS ); glTexGenfv( GL_T, GL_EYE_PLANE, genT ); glTexGenfv( GL_R, GL_EYE_PLANE, genR ); glTexGenfv( GL_Q, GL_EYE_PLANE, genQ ); can anybody explain to me what these two lines actually do? The redbook says these functions generate the texture-coordinates automatically, but from what? and how? I would really like to get an understanding of the code... thx a lot...

Share this post


Link to post
Share on other sites
Advertisement
I'm with you on this ! I understand shadow mapping at a high level - but this tex gen for 4 lots of tex units instead of the usual 2 confused me.
I've been reading a tutorial on it from gametutorials.com for hours !! There's only about 30 lines of code. I hope it isn;t going to be one of these techniques i end up using but don't understand,

Share this post


Link to post
Share on other sites
ok from gametutorials.com examples:
Quote:

Now comes the complicated part to grasp at first. If you have never used the
// texture generation functionality in OpenGL for sphere mapping or something else,
// I will give a basic explanation of what it does. So that we don't have to
// do the work ourselves of calculating every UV coordinate, we can have the UV
// coordinates generated by OpenGL for us, given a bunch of different inputs to work from.
// We can use OpenGL's texture generation functionality to project our camera depth values
// into the light's clip space. Since our matrices are 4x4, we need to do our
// projection in 4D. Thus, we use texture coordinates S, T, R and Q.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement