Documentation ¶
Overview ¶
Package texture contains several types of textures which can be added to materials.
Index ¶
- func DecodeImage(imgfile string) (*image.RGBA, error)
- type Animator
- type Texture2D
- func NewTexture2DFromCompressedData(width, height int, iformat int32, size int32, data any) *Texture2D
- func NewTexture2DFromData(width, height int, format int, formatType, iformat int, data any) *Texture2D
- func NewTexture2DFromImage(imgfile string) (*Texture2D, error)
- func NewTexture2DFromRGBA(rgba *image.RGBA) *Texture2D
- func (t *Texture2D) BindAndTransfer(gs *gls.GLS)
- func (t *Texture2D) Compressed() bool
- func (t *Texture2D) Dispose()
- func (t *Texture2D) GetUniformNames() (sampler, info string)
- func (t *Texture2D) Height() int
- func (t *Texture2D) Incref() *Texture2D
- func (t *Texture2D) Offset() (float32, float32)
- func (t *Texture2D) RenderSetup(gs *gls.GLS, slotIdx, uniIdx int)
- func (t *Texture2D) Repeat() (float32, float32)
- func (t *Texture2D) SetCompressedData(width, height int, iformat int32, size int32, data any)
- func (t *Texture2D) SetData(width, height int, format int, formatType, iformat int, data any)
- func (t *Texture2D) SetFlipY(state bool)
- func (t *Texture2D) SetFromRGBA(rgba *image.RGBA)
- func (t *Texture2D) SetImage(imgfile string) error
- func (t *Texture2D) SetMagFilter(magFilter uint32)
- func (t *Texture2D) SetMinFilter(minFilter uint32)
- func (t *Texture2D) SetOffset(x, y float32)
- func (t *Texture2D) SetRepeat(x, y float32)
- func (t *Texture2D) SetUniformNames(sampler, info string)
- func (t *Texture2D) SetVisible(state bool)
- func (t *Texture2D) SetWrapS(wrapS uint32)
- func (t *Texture2D) SetWrapT(wrapT uint32)
- func (t *Texture2D) TexName() uint32
- func (t *Texture2D) Visible() bool
- func (t *Texture2D) Width() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Animator ¶
type Animator struct {
// contains filtered or unexported fields
}
Animator can generate a texture animation based on a texture sheet
func NewAnimator ¶
NewAnimator creates and returns a texture sheet animator for the specified texture.
func (*Animator) SetDispTime ¶
SetDispTime sets the display time of each tile in milliseconds. The default value is: 1.0/30.0 = 16.6.ms
func (*Animator) SetMaxCycles ¶
SetMaxCycles sets the number of complete cycles to display. The default value is: 0 (display continuously)
type Texture2D ¶
type Texture2D struct {
// contains filtered or unexported fields
}
Texture2D represents a texture
func NewTexture2DFromCompressedData ¶
func NewTexture2DFromCompressedData(width, height int, iformat int32, size int32, data any) *Texture2D
NewTexture2DFromCompressedData creates a new compressed texture from data
func NewTexture2DFromData ¶
func NewTexture2DFromData(width, height int, format int, formatType, iformat int, data any) *Texture2D
NewTexture2DFromData creates a new texture from data
func NewTexture2DFromImage ¶
NewTexture2DFromImage creates and returns a pointer to a new Texture2D using the specified image file as data. Supported image formats are: PNG, JPEG and GIF.
func NewTexture2DFromRGBA ¶
NewTexture2DFromRGBA creates a new texture from a pointer to an RGBA image object.
func (*Texture2D) BindAndTransfer ¶ added in v0.2.3
BindAndTransfer binds the texture to the active texture unit and transfers data and parameters.
func (*Texture2D) Compressed ¶
Compressed returns whether this texture is compressed
func (*Texture2D) Dispose ¶
func (t *Texture2D) Dispose()
Dispose decrements this texture reference count and if necessary releases OpenGL resources and C memory associated with this texture.
func (*Texture2D) GetUniformNames ¶
GetUniformNames returns the names of the uniforms in the shader for sampler and texture info.
func (*Texture2D) Incref ¶
Incref increments the reference count for this texture and returns a pointer to the geometry. It should be used when this texture is shared by another material.
func (*Texture2D) RenderSetup ¶
RenderSetup binds the texture to the active texture unit and assigns it to a sampler slot.
func (*Texture2D) SetCompressedData ¶
SetCompressedData sets the compressed texture data
func (*Texture2D) SetFromRGBA ¶
SetFromRGBA sets the texture data from the specified image.RGBA object
func (*Texture2D) SetMagFilter ¶
SetMagFilter sets the filter to be applied when the texture element covers more than on pixel. The default value is gls.Linear.
func (*Texture2D) SetMinFilter ¶
SetMinFilter sets the filter to be applied when the texture element covers less than on pixel. The default value is gls.Linear.
func (*Texture2D) SetUniformNames ¶
SetUniformNames sets the names of the uniforms in the shader for sampler and texture info.
func (*Texture2D) SetVisible ¶
SetVisible sets the visibility state of the texture
func (*Texture2D) SetWrapS ¶
SetWrapS set the wrapping mode for texture S coordinate The default value is GL_CLAMP_TO_EDGE;
func (*Texture2D) SetWrapT ¶
SetWrapT set the wrapping mode for texture T coordinate The default value is GL_CLAMP_TO_EDGE;