mirror of
https://github.com/patriciogonzalezvivo/thebookofshaders
synced 2024-11-11 13:10:57 +00:00
26 lines
1.2 KiB
Markdown
26 lines
1.2 KiB
Markdown
## Texture2D
|
|
Retrieves texels from a texture
|
|
|
|
### Các phiên bản
|
|
```glsl
|
|
vec4 textureCube(samplerCube sampler, vec3 coord)
|
|
vec4 textureCube(samplerCube sampler, vec3 coord, float bias)
|
|
```
|
|
|
|
### Các tham số
|
|
```sampler``` specifies the sampler to which the texture from which texels will be retrieved is bound.
|
|
|
|
```coord``` specifies the texture coordinates at which texture will be sampled.
|
|
|
|
```bias``` specifies an optional bias to be applied during level-of-detail computation.
|
|
|
|
### Mô tả
|
|
The textureCube function returns a texel, i.e. the (color) value of the texture for the given coordinates. The function has one input parameter of the type samplerCube and one input parameter of the type vec3 : sampler, the uniform the texture is bound to, and coord, the 3-dimensional coordinates of the texel to look up.
|
|
|
|
There is an optional third input parameter of the type float: bias. After calculating the appropriate level of detail for a texture with mipmaps the bias is added before the actual texture lookup operation is executed.
|
|
|
|
Side note: On iOS devices texture lookup functionality is only available in the fragment shader.
|
|
|
|
### Tham khảo thêm
|
|
[texture2D](/glossary/?lan=vi&search=texture2D)
|