View Full Version : TexGen mathematics
05-18-2002, 10:37 PM
For GL_OBJECT_LINEAR, the equation is said to be
p1 x0 + p2 y0 + p3 z0 +p4 w
but is that for all of the tex components (s, t, r, q)
Same question for GL_EYE_LINEAR.
What is considered invalid for TexGen? Once I put
glTexGenf(GL_R, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
I was getting GL_INVALID_ENUM (I think that was it)
What about cube maps? How are tex coords computed and the faces fetched?
That's it in terms of TexGen I beleive. Did I miss one?
Yes, that equation holds for all texture dimensions that you have texgen enabled for. Each one can have it's own set of four parameters (really a plane equation). Same thing for eye linear.
Probably what is considered valid or not for your texgen mode depends on the hardware and drivers you are using...
Cube maps get accessed in the following manner: Whichever texture coordinate has the largest magnitude indicates which of the six faces get indexed. The remaining two texture coordinates do a lookup within that 2D texture.
I use the texgen planes as a replacement for the texture matrix on GeForce level hardware ( especially on GeForce1 ). This was a tip I got from Cass when I was having some performance issues with projected textures and VAR ( GeForce2 and above doesn't have this performance issue but I use this workaround anyway ).
Regarding validity of what TexGen accepts - you are allowed to mix any modes you like and for any coordinates EXCEPT if documented otherwise in the various specs. For the example you gave, GL_R or GL_Q is not allowed.
05-20-2002, 10:39 PM
>>>Regarding validity of what TexGen accepts - you are allowed to mix any modes you like and for any coordinates EXCEPT if documented otherwise in the various specs. For the example you gave, GL_R or GL_Q is not allowed.
The Red book 1.1 doesnt have much info and Im not sure if the spec for 1.2 or 1.3 (on line files) have this info. What's wrong with GL_R and GL_SPHERE_MAP? Is it because Im using GL_TEXTURE_2D?
I read that thing about cubemaps in the spec. I guess Ill try to figure it out.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.