glTexParameter: Unterschied zwischen den Versionen

Aus DGL Wiki
Wechseln zu: Navigation, Suche
K (Wird offline bearbeitet)
 
(Version Hochgeladen)
Zeile 1: Zeile 1:
{{Offline}}
+
{{Unvollständig}}
 +
= glTexParameter =
 +
 
 +
<br>
 +
== Name ==
 +
'''glTexParameter''' Funktionen - setzen Textureigenschaften.
 +
 
 +
<br>
 +
== Delphi-Spezifikation ==
 +
procedure '''glTexParameterf'''(''target'': TGLenum; ''pname'': TGLenum; ''param'': TGLfloat);
 +
procedure '''glTexParameteri'''(''target'': TGLenum; ''pname'': TGLenum; ''param'': TGLint);
 +
 
 +
<br>
 +
== Parameter ==
 +
<table border=1 rules=all>
 +
<tr>
 +
<td>''target''</td>
 +
<td>Bestimmt die Zieltextur welche '''GL_TEXTURE_1D, GL_TEXTURE_2D''' oder '''GL_TEXTURE_3D''' sein kann.</td>
 +
</tr>
 +
<tr>
 +
<td>''pname''</td>
 +
<td>Bestimmt den symbolischen Namen eines Parameters der einen Einzelwert enthält. Folgende Werte werden akzeptiert:<br>
 +
'''GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_WRAP_S,''' oder '''GL_TEXTURE_WRAP_T'''.</td>
 +
</tr>
 +
<tr>
 +
<td>''param''</td>
 +
<td>Enthält den Wert für ''pname''.</td>
 +
</tr>
 +
</table>
 +
 
 +
<br>
 +
== Delphi-Spezifikation ==
 +
procedure '''glTexParameterfv'''(''target'': TGLenum; ''pname'': TGLenum; const ''params'': PGLfloat);
 +
procedure '''glTexParameteriv'''(''target'': TGLenum; ''pname'': TGLenum; const ''params'': PGLint);
 +
 
 +
<br>
 +
== Parameter ==
 +
<table border=1 rules=all>
 +
<tr>
 +
<td>''target''</td>
 +
<td>Bestimmt die Zieltextur welche '''GL_TEXTURE_1D, GL_TEXTURE_2D''' oder '''GL_TEXTURE_3D''' sein kann.</td>
 +
</tr>
 +
<tr>
 +
<td>''pname''</td>
 +
<td>Bestimmt den symbolischen Namen eines Parameters der einen Einzelwert enthält. Folgende Werte werden akzeptiert:<br>
 +
'''GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T''' oder '''GL_TEXTURE_BORDER_COLOR'''.</td>
 +
</tr>
 +
<tr>
 +
<td>''params''</td>
 +
<td>Ist ein Zeiger auf ein Feld welches die oder den Wert für ''pname'' enthält.</td>
 +
</tr>
 +
</table>
 +
 
 +
<br>
 +
== Beschreibung ==
 +
<b><i>
 +
Texture mapping is a technique that applies an image onto an object's surface as if the image were a decal or cellophane shrink-wrap. The image is created in texture space, with an (s, t) coordinate system. A texture is a one- or two-dimensional image and a set of parameters that determine how samples are derived from the image.
 +
 
 +
The glTexParameter function assigns the value or values in params to the texture parameter specified as pname. target defines the target texture, either GL_TEXTURE_1D or GL_TEXTURE_2D. The following symbols are accepted in pname:
 +
</i></b>
 +
 
 +
'''GL_TEXTURE_MIN_FILTER'''
 +
<b><i>
 +
: The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps.
 +
: A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions 2^nx2^m there are max(n, m) + 1 mipmaps. The first mipmap is the original texture, with dimensions 2^nx2^m. Each subsequent mipmap has dimensions 2^k (-1) x2^l (-1)  where 2^kx2^l are the dimensions of the previous mipmap, until either k = 0 or l = 0. At that point, subsequent mipmaps have dimension 1x2^l-1 or 2^k-1x1 until the final mipmap, which has dimension 1x1. Mipmaps are defined using glTexImage1D or glTexImage2D with the level-of-detail argument indicating the order of the mipmaps. Level 0 is the original texture; level bold max(n, m) is the final 1x1 mipmap.
 +
</i></b>
 +
 
 +
''params'' liefert Funktionen zur Verkleinerung von Texturen. Dies wären:
 +
 
 +
'''GL_NEAREST'''
 +
<b><i>
 +
: Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.
 +
</i></b>
 +
'''GL_LINEAR'''
 +
<b><i>
 +
: Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T, and on the exact mapping.
 +
</i></b>
 +
'''GL_NEAREST_MIPMAP_NEAREST'''
 +
<b><i>
 +
: Chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value.
 +
</i></b>
 +
'''GL_LINEAR_MIPMAP_NEAREST'''
 +
<b><i>
 +
: Chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value.
 +
</i></b>
 +
'''GL_NEAREST_MIPMAP_LINEAR'''
 +
<b><i>
 +
: Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value from each mipmap.  The final texture value is a weighted average of those two values.
 +
</i></b>
 +
'''GL_LINEAR_MIPMAP_LINEAR'''
 +
<b><i>
 +
: Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
 +
</i></b>
 +
 
 +
<b><i>
 +
As more texture elements are sampled in the minification process, fewer aliasing artifacts will be apparent. While the GL_NEAREST and GL_LINEAR minification functions can be faster than the other four, they sample only one or four texture elements to determine the texture value of the pixel being rendered and can produce moire patterns or ragged transitions. The default value of GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR.
 +
</i></b>
 +
 
 +
'''GL_TEXTURE_MAG_FILTER '''
 +
<b><i>
 +
: The texture magnification function is used when the pixel being textured maps to an area less than or equal to one texture element. It sets the texture magnification function to either of the following:
 +
</i></b>
 +
: '''GL_NEAREST'''
 +
<b><i>
 +
:: Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.
 +
</i></b>
 +
: '''GL_LINEAR'''
 +
<b><i>
 +
:: Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T, and on the exact mapping.
 +
:: GL_NEAREST is generally faster than GL_LINEAR, but it can produce textured images with sharper edges because the transition between texture elements is not as smooth.  The default value of GL_TEXTURE_MAG_FILTER is GL_LINEAR.
 +
</i></b>
 +
 
 +
'''GL_TEXTURE_WRAP_S '''
 +
<b><i>
 +
: Sets the wrap parameter for texture coordinate s to either GL_CLAMP or GL_REPEAT. GL_CLAMP causes s coordinates to be clamped to the range [0,1] and is useful for preventing wrapping artifacts when mapping a single image onto an object. GL_REPEAT causes the integer part of the s coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. Border texture elements are accessed only if wrapping is set to GL_CLAMP. Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT.
 +
</i></b>
 +
 
 +
'''GL_TEXTURE_WRAP_T'''
 +
<b><i>
 +
: Sets the wrap parameter for texture coordinate t to either GL_CLAMP or GL_REPEAT. See the discussion under GL_TEXTURE_WRAP_S.  Initially, GL_TEXTURE_WRAP_T is set to GL_REPEAT.
 +
</i></b>
 +
 
 +
'''GL_TEXTURE_BORDER_COLOR '''
 +
<b><i>
 +
: Sets a border color. The params parameter contains four values that comprise the RGBA color of the texture border. Integer color components are interpreted linearly such that the most positive integer maps to 1.0, and the most negative integer maps to -1.0. The values are clamped to the range [0,1] when they are specified. Initially, the border color is (0, 0, 0, 0).
 +
</i></b>
 +
 
 +
<br>
 +
== Hinweise ==
 +
<b><i>
 +
Suppose texturing is enabled (by calling glEnable with argument GL_TEXTURE_1D or GL_TEXTURE_2D) and GL_TEXTURE_MIN_FILTER is set to one of the functions that requires a mipmap. If either the dimensions of the texture images currently defined (with previous calls to glTexImage1D or glTexImage2D) do not follow the proper sequence for mipmaps, or there are fewer texture images defined than are needed, or the set of texture images have differing numbers of texture components, then it is as if texture mapping were disabled.
 +
 
 +
Linear filtering accesses the four nearest texture elements only in 2-D textures. In 1-D textures, linear filtering accesses the two nearest texture elements.
 +
</i></b>
 +
 
 +
<br>
 +
== Fehlermeldungen ==
 +
'''GL_INVALID_Enum''' wird generiert wenn ''target'' oder ''pname'' kein gültiger Wert übergeben wurde, oder wenn ''params'' einen definierten, konstanten Wert (basierend auf den Wert von ''pname'') erwartet und diesen nicht bekommt.<br>
 +
'''GL_INVALID_OPERATION''' wird generiert wenn '''glTexParameter''' innerhalb eines [[glBegin]]-[[glEnd]] Blocks aufgerufen wird.
 +
 
 +
<br>
 +
==  Zugehörige Wertrückgaben ==
 +
[[glGetTexParameter]]<br>
 +
[[glGetTexLevelParameter]]
 +
 
 +
<br>
 +
 
 +
== Siehe auch ==
 +
[[glTexEnv]], [[glTexImage1D]], [[glTexImage2D]], [[glTexGen]]
 +
 
 +
[[Kategorie:GL|TexParameter]]

Version vom 14. September 2004, 21:08 Uhr

Hinweis: Dieser Artikel ist noch unvollständig.
(Mehr Informationen/weitere Artikel)

{{{1}}}

Incomplete.jpg

glTexParameter


Name

glTexParameter Funktionen - setzen Textureigenschaften.


Delphi-Spezifikation

procedure glTexParameterf(target: TGLenum; pname: TGLenum; param: TGLfloat);
procedure glTexParameteri(target: TGLenum; pname: TGLenum; param: TGLint);


Parameter

target Bestimmt die Zieltextur welche GL_TEXTURE_1D, GL_TEXTURE_2D oder GL_TEXTURE_3D sein kann.
pname Bestimmt den symbolischen Namen eines Parameters der einen Einzelwert enthält. Folgende Werte werden akzeptiert:
GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_WRAP_S, oder GL_TEXTURE_WRAP_T.
param Enthält den Wert für pname.


Delphi-Spezifikation

procedure glTexParameterfv(target: TGLenum; pname: TGLenum; const params: PGLfloat);
procedure glTexParameteriv(target: TGLenum; pname: TGLenum; const params: PGLint);


Parameter

target Bestimmt die Zieltextur welche GL_TEXTURE_1D, GL_TEXTURE_2D oder GL_TEXTURE_3D sein kann.
pname Bestimmt den symbolischen Namen eines Parameters der einen Einzelwert enthält. Folgende Werte werden akzeptiert:
GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T oder GL_TEXTURE_BORDER_COLOR.
params Ist ein Zeiger auf ein Feld welches die oder den Wert für pname enthält.


Beschreibung

Texture mapping is a technique that applies an image onto an object's surface as if the image were a decal or cellophane shrink-wrap. The image is created in texture space, with an (s, t) coordinate system. A texture is a one- or two-dimensional image and a set of parameters that determine how samples are derived from the image.

The glTexParameter function assigns the value or values in params to the texture parameter specified as pname. target defines the target texture, either GL_TEXTURE_1D or GL_TEXTURE_2D. The following symbols are accepted in pname:

GL_TEXTURE_MIN_FILTER

The texture minifying function is used whenever the pixel being textured maps to an area greater than one texture element. There are six defined minifying functions. Two of them use the nearest one or nearest four texture elements to compute the texture value. The other four use mipmaps.
A mipmap is an ordered set of arrays representing the same image at progressively lower resolutions. If the texture has dimensions 2^nx2^m there are max(n, m) + 1 mipmaps. The first mipmap is the original texture, with dimensions 2^nx2^m. Each subsequent mipmap has dimensions 2^k (-1) x2^l (-1) where 2^kx2^l are the dimensions of the previous mipmap, until either k = 0 or l = 0. At that point, subsequent mipmaps have dimension 1x2^l-1 or 2^k-1x1 until the final mipmap, which has dimension 1x1. Mipmaps are defined using glTexImage1D or glTexImage2D with the level-of-detail argument indicating the order of the mipmaps. Level 0 is the original texture; level bold max(n, m) is the final 1x1 mipmap.

params liefert Funktionen zur Verkleinerung von Texturen. Dies wären:

GL_NEAREST

Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.

GL_LINEAR

Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T, and on the exact mapping.

GL_NEAREST_MIPMAP_NEAREST

Chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value.

GL_LINEAR_MIPMAP_NEAREST

Chooses the mipmap that most closely matches the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value.

GL_NEAREST_MIPMAP_LINEAR

Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.

GL_LINEAR_MIPMAP_LINEAR

Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_LINEAR criterion (a weighted average of the four texture elements that are closest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.

As more texture elements are sampled in the minification process, fewer aliasing artifacts will be apparent. While the GL_NEAREST and GL_LINEAR minification functions can be faster than the other four, they sample only one or four texture elements to determine the texture value of the pixel being rendered and can produce moire patterns or ragged transitions. The default value of GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR.

GL_TEXTURE_MAG_FILTER

The texture magnification function is used when the pixel being textured maps to an area less than or equal to one texture element. It sets the texture magnification function to either of the following:

GL_NEAREST

Returns the value of the texture element that is nearest (in Manhattan distance) to the center of the pixel being textured.

GL_LINEAR

Returns the weighted average of the four texture elements that are closest to the center of the pixel being textured. These can include border texture elements, depending on the values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T, and on the exact mapping.
GL_NEAREST is generally faster than GL_LINEAR, but it can produce textured images with sharper edges because the transition between texture elements is not as smooth. The default value of GL_TEXTURE_MAG_FILTER is GL_LINEAR.

GL_TEXTURE_WRAP_S

Sets the wrap parameter for texture coordinate s to either GL_CLAMP or GL_REPEAT. GL_CLAMP causes s coordinates to be clamped to the range [0,1] and is useful for preventing wrapping artifacts when mapping a single image onto an object. GL_REPEAT causes the integer part of the s coordinate to be ignored; the GL uses only the fractional part, thereby creating a repeating pattern. Border texture elements are accessed only if wrapping is set to GL_CLAMP. Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT.

GL_TEXTURE_WRAP_T

Sets the wrap parameter for texture coordinate t to either GL_CLAMP or GL_REPEAT. See the discussion under GL_TEXTURE_WRAP_S. Initially, GL_TEXTURE_WRAP_T is set to GL_REPEAT.

GL_TEXTURE_BORDER_COLOR

Sets a border color. The params parameter contains four values that comprise the RGBA color of the texture border. Integer color components are interpreted linearly such that the most positive integer maps to 1.0, and the most negative integer maps to -1.0. The values are clamped to the range [0,1] when they are specified. Initially, the border color is (0, 0, 0, 0).


Hinweise

Suppose texturing is enabled (by calling glEnable with argument GL_TEXTURE_1D or GL_TEXTURE_2D) and GL_TEXTURE_MIN_FILTER is set to one of the functions that requires a mipmap. If either the dimensions of the texture images currently defined (with previous calls to glTexImage1D or glTexImage2D) do not follow the proper sequence for mipmaps, or there are fewer texture images defined than are needed, or the set of texture images have differing numbers of texture components, then it is as if texture mapping were disabled.

Linear filtering accesses the four nearest texture elements only in 2-D textures. In 1-D textures, linear filtering accesses the two nearest texture elements.


Fehlermeldungen

GL_INVALID_Enum wird generiert wenn target oder pname kein gültiger Wert übergeben wurde, oder wenn params einen definierten, konstanten Wert (basierend auf den Wert von pname) erwartet und diesen nicht bekommt.
GL_INVALID_OPERATION wird generiert wenn glTexParameter innerhalb eines glBegin-glEnd Blocks aufgerufen wird.


Zugehörige Wertrückgaben

glGetTexParameter
glGetTexLevelParameter


Siehe auch

glTexEnv, glTexImage1D, glTexImage2D, glTexGen