Documentation ¶
Overview ¶
Package texture provides classes for creating and storing images and textures.
Package texture provides classes for creating and storing images and textures.
Package texture provides classes for creating and storing images and textures.
Package texture provides classes for creating and storing images and textures.
Package texture provides classes for creating and storing images and textures.
Index ¶
- type Format
- type InternalFormat
- type PixelType
- type Texture
- func Make(width, height int, internalformat int32, format, pixelType uint32, ...) Texture
- func Make3D(width, height, depth, internalformat int32, format, pixelType uint32, ...) Texture
- func Make3DFromData(data []uint8, width, height, slices int, internalformat int32, format uint32) (Texture, error)
- func Make3DFromImage(image3d *image3d.Image3D, internalformat int32, format uint32) (Texture, error)
- func Make3DFromPath(paths []string, internalformat int32, format uint32) (Texture, error)
- func MakeColor(width, height int) Texture
- func MakeColorMultisample(width, height, samples int) Texture
- func MakeCubeMap(right, left, top, bottom, front, back string, inside bool, ...) (Texture, error)
- func MakeDepth(width, height int) Texture
- func MakeDepthMultisample(width, height, samples int) Texture
- func MakeEmpty() Texture
- func MakeEmptyCubeMap(dim int, internalformat int32, format, pixelType uint32) (Texture, error)
- func MakeFromData(data []uint8, width, height int, internalformat int32, format uint32) (Texture, error)
- func MakeFromImage(image *image2d.Image2D, internalformat int32, format uint32) Texture
- func MakeFromPath(path string, internalformat int32, format uint32) (Texture, error)
- func MakeFromPathFixedChannels(path string, channels int, internalformat int32, format uint32) (Texture, error)
- func MakeMultisample(width, height, samples int, format uint32, min, mag, s, t int32) Texture
- func (tex *Texture) Bind(index uint32)
- func (tex *Texture) Delete()
- func (tex *Texture) DownloadCubeMapImages(format, pixeltype uint32) ([]image2d.Image2D, error)
- func (tex *Texture) DownloadImage2D(format, pixeltype uint32) (image2d.Image2D, error)
- func (tex *Texture) GenMipmap()
- func (tex *Texture) GetHandle() uint32
- func (tex *Texture) SetMinMagFilter(min, mag int32)
- func (tex *Texture) SetWrap1D(s int32)
- func (tex *Texture) SetWrap2D(s, t int32)
- func (tex *Texture) SetWrap3D(s, t, r int32)
- func (tex *Texture) Unbind()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format uint32
Format specifies the format of a pixel of a pixel of the image data.
type InternalFormat ¶
type InternalFormat int32
InternalFormat specifies the format of a pixel on the GPU.
const ( INTERNALFORMAT_RED InternalFormat = gl.RED INTERNALFORMAT_RG InternalFormat = gl.RG INTERNALFORMAT_RGB InternalFormat = gl.RGB INTERNALFORMAT_RGBA InternalFormat = gl.RGBA )
List of supported internal formats.
type PixelType ¶
type PixelType uint32
PixelType specifies the data type of a single component of the image data.
const ( PIXELTYPE_UNSIGNED_BYTE PixelType = gl.UNSIGNED_BYTE PIXELTYPE_UNSIGNED_INT PixelType = gl.UNSIGNED_INT PIXELTYPE_FLOAT PixelType = gl.FLOAT )
List of supported pixel types.
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
Texture holds no to several images.
func Make ¶
func Make(width, height int, internalformat int32, format, pixelType uint32, data unsafe.Pointer, min, mag, s, t int32) Texture
Make creates a texture the given width and height. Internalformat, format and pixelType specifed the layout of the data. Internalformat is the format of the texture on the GPU. Format is the format of the pixeldata that provided to this function. Pixeltype specifies the data type of a single component of the pixeldata. Data is pointing to the data that is going to be uploaded. Min and mag specify the behaviour when down and upscaling the texture. S and t specify the behaviour at the borders of the image.
func Make3D ¶
func Make3D(width, height, depth, internalformat int32, format, pixelType uint32, data unsafe.Pointer, min, mag, s, t, r int32) Texture
Make3D constructs a 3D texture of the width and height of each image per slice and depth describing the number of slices. Internalformat, format and pixelType specifed the layout of the data. Data is pointing to the data that is going to be uploaded. The data layout is slices first then rows and lastly columns. Min and mag specify the behaviour when down and upscaling the texture. S and t specify the behaviour at the borders of the image. r specified the behaviour between the slices.
func Make3DFromData ¶
func Make3DFromData(data []uint8, width, height, slices int, internalformat int32, format uint32) (Texture, error)
Make3DFromData creates a 3D texture with the data of the 3D image.
func Make3DFromImage ¶
func Make3DFromImage(image3d *image3d.Image3D, internalformat int32, format uint32) (Texture, error)
Make3DFromImage creates a 3D texture with the data of the 3D image.
func Make3DFromPath ¶
Make3DFromPath creates a 3D texture with the data of the images specifed by the provided paths.
func MakeColorMultisample ¶
MakeColorMultisample creates a multisample color texture of the given width and height and the number of samples that should be used.
func MakeCubeMap ¶
func MakeCubeMap(right, left, top, bottom, front, back string, inside bool, internalformat int32) (Texture, error)
MakeCubeMap creates a cube map with the images specfied from the path. For usage with skyboxes where textures are on the inside of the cube, set the inside parameter to true to flip all textures horizontally, otherwise set this parameter to false. The internal format describes the format of the texture on the gpu. If the images are not quadratic and a power of two, they will automatically be subsampled to fit the required size.
func MakeDepthMultisample ¶
MakeDepthMultisample creates a multisample depth texture of the given width and height and the number of samples that should be used.
func MakeEmptyCubeMap ¶
MakeEmptyCubeMap creates an empty cube map of the specified dimension, internal format on the GPU, format of the image data and the pixel type of the data. The image dimension has to be a power of two.
func MakeFromData ¶
func MakeFromData(data []uint8, width, height int, internalformat int32, format uint32) (Texture, error)
MakeFromData creates a texture
func MakeFromImage ¶
MakeFromImage grabs the dimensions and information from the image
func MakeFromPath ¶
MakeFromPath creates a texture with the image data specifed in path.
func MakeFromPathFixedChannels ¶
func MakeFromPathFixedChannels(path string, channels int, internalformat int32, format uint32) (Texture, error)
MakeFromPathFixedChannels creates a texture with the image data specifed in path. The number is enforced no matter how many channels the image in the specified file actually has.
func MakeMultisample ¶
MakeMultisample creates a multisample texture of the given width and height and the number of samples that should be used. Internalformat, format and pixelType specifed the layout of the data. Data is pointing to the data that is going to be uploaded. Min and mag specify the behaviour when down and upscaling the texture. S and t specify the behaviour at the borders of the image.
func (*Texture) DownloadCubeMapImages ¶
DownloadCubeMapImages extracts texture data from the GPU into 6 Image2D for each side of the cube map.
func (*Texture) DownloadImage2D ¶
DownloadImage2D texture data from the GPU into an Image2D.
func (*Texture) GenMipmap ¶
func (tex *Texture) GenMipmap()
GenMipmap generates mipmap levels. Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_LINEAR criterion to produce a texture value.
func (*Texture) SetMinMagFilter ¶
SetMinMagFilter sets the filter to determine which behaviour is used for level of detail functions.