PDA

View Full Version : glTexGen



miko
03-06-2003, 01:44 AM
i need to compute texture coordinate using linear equation based on current modelview matrix multiplied by current vertex (something like GL_OBJECT_LINEAR but apply modelview matrix before)...

simply i want to assign higher coordinate to vertex with higher z. that coordinate should be computed after transformation because my scene is build from variuos pieces, translated and rotated together.

it could be possible to use GL_OBJECT_LINEAR and after each change of modelview matrix change texture matrix too... is this a good aproach or is there something better?

[This message has been edited by miko (edited 03-06-2003).]

JustHanging
03-06-2003, 03:10 AM
Hi,

You can use GL_EYE_LINEAR, it generates the texCoords the way you want. With eye linear, it's essential where you define the eye planes (as opposed to objects planes in object linear). If you need the absolute z:s you define them before the camera transform, and if you need the depth from camera, define them after it.

-Ilkka

miko
03-06-2003, 03:33 AM
actually GL_EYE_LINEAR was my first choice but it produced weird results. the problem was just as you said, i generated texture coordinats BEFORE gluLookAt. now it's working cool! thnx!!! http://www.opengl.org/discussion_boards/ubb/biggrin.gif