glTexGen

Aus DGL Wiki
Version vom 14. September 2004, 22:03 Uhr von Flash (Diskussion | Beiträge) (Version Hochgeladen)

Wechseln zu: Navigation, Suche
Hinweis: Dieser Artikel ist noch unvollständig.
(Mehr Informationen/weitere Artikel)

{{{1}}}

Incomplete.jpg

glTexGen


Name

glTexGen Funktionen - kontrollieren die Generierung der Texturkoordinaten.


Delphi-Spezifikation

procedure glTexGend(coord: TGLenum; pname: TGLenum; param: TGLdouble);
procedure glTexGenf(coord: TGLenum; pname: TGLenum; param: TGLfloat);
procedure glTexGeni(coord: TGLenum; pname: TGLenum; param: TGLint);


Parameter

coord Bestimmt die Texturkoordinate. Muss eine der folgenden sein:
GL_S, GL_T, GL_R, oder GL_Q.
pname Ist der symbolische Name einer Funktion zur Generierung von Texturkoordinaten.
Muss GL_TEXTURE_GEN_MODE sein.
param Ist ein einzelner Texturgenerierungsparameter. Kann GL_OBJECT_LINEAR, GL_EYE_LINEAR, oder GL_SPHERE_MAP sein.


Delphi-Spezifikation

procedure glTexGendv(coord: TGLenum; pname: TGLenum; const params: PGLdouble);
procedure glTexGenfv(coord: TGLenum; pname: TGLenum; const params: PGLfloat);
procedure glTexGeniv(coord: TGLenum; pname: TGLenum; const params: PGLint);


Parameter

coord Bestimmt die Texturkoordinate. Muss eine der folgenden sein:
GL_S, GL_T, GL_R, oder GL_Q.
pname Ist der symbolische Name einer Funktion zur Generierung von Texturkoordinaten oder eines Funktionsparameters.
Muss GL_TEXTURE_GEN_MODE, GL_OBJECT_PLANE, oder GL_EYE_PLANE sein.
params Ist ein Zeiger auf ein Feld mit Texturgenerierungsparameter.

Wenn pname GL_TEXTURE_GEN_MODE ist, muss das Feld eine einzelne symbolische Konstante enthälten. Diese kann GL_OBJECT_LINEAR, GL_EYE_LINEAR, oder GL_SPHERE_MAP sein.

In allen anderen Fällen enthält das Feld die Koeffizienten für die Texturgenerierungsfunktion die mit pname ausgewählt wurde.


Beschreibung

The glTexGen function selects a texture-coordinate generation function or supplies coefficients for one of the functions. coord names one of the (s,t,r, q) texture coordinates, and it must be one of these symbols: GL_S, GL_T , GL_R, or GL_Q. pname must be one of three symbolic constants: GL_TEXTURE_GEN_MODE, GL_OBJECT_PLANE, or GL_EYE_PLANE. If pname is GL_TEXTURE_GEN_MODE, then params chooses a mode, one of GL_OBJECT_LINEAR, GL_EYE_LINEAR, or GL_SPHERE_MAP. If pname is either GL_OBJECT_PLANE or GL_EYE_PLANE, params contains coefficients for the corresponding texture generation function.

If the texture generation function is GL_OBJECT_LINEAR, the function

Funktionsformel als Bild einfügen

is used, where g is the value computed for the coordinate named in coord , p (1) , p (2) , p (3) , and p (4) are the four values supplied in params, and x (o) , y (o) , z (o) , and w (o) are the object coordinates of the vertex. This function can be used to texture-map terrain using sea level as a reference plane (defined by p (1) , p (2) , p (3) , and p (4) ). The altitude of a terrain vertex is computed by the GL_OBJECT_LINEAR coordinate generation function as its distance from sea level; that altitude is used to index the texture image to map white snow onto peaks and green grass onto foothills, for example.

If the texture generation function is GL_EYE_LINEAR, the function is used, where

Funktionsformel als Bild einfügen

and x (e) , y (e) , z (e) , and w (e) are the eye coordinates of the vertex, p (1) , p (2) , p (3) , and p (4) are the values supplied in params, and M is the modelview matrix when glTexGen is invoked. If M is poorly conditioned or singular, texture coordinates generated by the resulting function may be inaccurate or undefined. Note that the values in params define a reference plane in eye coordinates. The modelview matrix that is applied to them may not be the same one in effect when the polygon vertexes are transformed. This function establishes a field of texture coordinates that can produce dynamic contour lines on moving objects.

If pname is GL_SPHERE_MAP and coord is either GL_S or GL_T, s and t texture coordinates are generated as follows. Let u be the unit vector pointing from the origin to the polygon vertex (in eye coordinates). Let n¢ be the current normal, after transformation to eye coordinates. Let f = (f (x ) f (y ) f (z) )T be the reflection vector such that

Funktionsformel als Bild einfügen
Finally, let
Funktionsformel als Bild einfügen Then the values assigned to the i and t texture coordinates are
Funktionsformel als Bild einfügen

A texture-coordinate generation function is enabled or disabled using glEnable or glDisable with one of the symbolic texture-coordinate names (GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R, or GL_TEXTURE_GEN_Q) as the argument. When enabled, the specified texture coordinate is computed according to the generating function associated with that coordinate. When disabled, subsequent vertexes take the specified texture coordinate from the current set of texture coordinates.


Hinweise

Der Initialisierungszustand ist folgender:

  1. Alle Texturgenerierungsfunktionen stehen auf GL_EYE_LINEAR und sind deaktiviert.
  2. Beide s Ebenengleichungen stehen auf (1,0,0,0).
  3. Beide t Ebenengleichungen stehen auf (0,1,0,0).
  4. Alle r und q Ebenengleichungen stehen auf (0,0,0,0).


Fehlermeldungen

GL_INVALID_ENUM wird generiert wenn coord oder pname ungültige Werte übergeben werden oder wenn pname GL_TEXTURE_GEN_MODE ist und params keinen gültigen Wert enthält.
GL_INVALID_ENUM wird generiert wenn gleichzeitig pname GL_TEXTURE_GEN_MODE, params GL_SPHERE_MAP und coord entweder GL_R oder GL_Q ist.
GL_INVALID_OPERATION wird generiert wenn glTexGen innerhalb eines glBegin-glEnd Blocks aufgerufen wird.


Zugehörige Wertrückgaben

glGetTexGen
glIsEnabled mit Token GL_TEXTURE_GEN_S
glIsEnabled mit Token GL_TEXTURE_GEN_T
glIsEnabled mit Token GL_TEXTURE_GEN_R
glIsEnabled mit Token GL_TEXTURE_GEN_Q


Siehe auch

glTexEnv, glTexImage1D, glTexImage2D, glTexParameter