이 API는 실험적입니다
향후 p5.js 버전에서 동작이 변경될 수 있습니다.
Retrieves the current color of a given texture at given coordinates.
The given coordinates should be between [0, 0] representing the top-left of the texture, and [1, 1] representing the bottom-right of the texture.
The given texture could be, for example:
- p5.Image,
- a p5.Graphics, or
- a p5.Framebuffer.
The retrieved color that is returned will behave like a vec4, with components for red, green, blue, and alpha, each between 0.0 and 1.0.
Linear interpolation is used by default. For Framebuffer sources, you can prevent this by creating the buffer with:
createFramebuffer({
textureFiltering: NEAREST
})This can be useful if you are using your texture to store data other than color. See createFramebuffer.
Note: The getTexture function is only available when using p5.strands.
예제
구문
getTexture(texture, coords)
매개변수
반환값
관련 레퍼런스
baseColorShader
Returns the default shader used for fills when no lights or textures are activate.
baseFilterShader
Returns the base shader used for filters.
baseMaterialShader
Returns the default shader used for fills when lights or textures are used.
baseNormalShader
Returns the default shader used for fills when normalMaterial() is activated.