texture

package
v0.0.0-...-23eb0d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 5 Imported by: 0

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

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.

const (
	FORMAT_RED  Format = gl.RED
	FORMAT_RG   Format = gl.RG
	FORMAT_RGB  Format = gl.RGB
	FORMAT_RGBA Format = gl.RGBA
)

List of supported formats.

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

func Make3DFromPath(paths []string, internalformat int32, format uint32) (Texture, error)

Make3DFromPath creates a 3D texture with the data of the images specifed by the provided paths.

func MakeColor

func MakeColor(width, height int) Texture

MakeColor creates a color texture of the specified size.

func MakeColorMultisample

func MakeColorMultisample(width, height, samples int) Texture

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 MakeDepth

func MakeDepth(width, height int) Texture

MakeDepth creates a depth texture of the specfied size.

func MakeDepthMultisample

func MakeDepthMultisample(width, height, samples int) Texture

MakeDepthMultisample creates a multisample depth texture of the given width and height and the number of samples that should be used.

func MakeEmpty

func MakeEmpty() Texture

MakeEmpty creates a Texture with no image data.

func MakeEmptyCubeMap

func MakeEmptyCubeMap(dim int, internalformat int32, format, pixelType uint32) (Texture, error)

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

func MakeFromImage(image *image2d.Image2D, internalformat int32, format uint32) Texture

MakeFromImage grabs the dimensions and information from the image

func MakeFromPath

func MakeFromPath(path string, internalformat int32, format uint32) (Texture, error)

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

func MakeMultisample(width, height, samples int, format uint32, min, mag, s,
	t int32) Texture

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) Bind

func (tex *Texture) Bind(index uint32)

Bind makes the texure available at the specified position.

func (*Texture) Delete

func (tex *Texture) Delete()

Delete destroys the Texture.

func (*Texture) DownloadCubeMapImages

func (tex *Texture) DownloadCubeMapImages(format, pixeltype uint32) ([]image2d.Image2D, error)

DownloadCubeMapImages extracts texture data from the GPU into 6 Image2D for each side of the cube map.

func (*Texture) DownloadImage2D

func (tex *Texture) DownloadImage2D(format, pixeltype uint32) (image2d.Image2D, error)

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) GetHandle

func (tex *Texture) GetHandle() uint32

GetHandle returns the OpenGL of this texture.

func (*Texture) SetMinMagFilter

func (tex *Texture) SetMinMagFilter(min, mag int32)

SetMinMagFilter sets the filter to determine which behaviour is used for level of detail functions.

func (*Texture) SetWrap1D

func (tex *Texture) SetWrap1D(s int32)

SetWrap1D sets the behavior at the 1D texure borders

func (*Texture) SetWrap2D

func (tex *Texture) SetWrap2D(s, t int32)

SetWrap2D sets the behavior at the 2D texure borders

func (*Texture) SetWrap3D

func (tex *Texture) SetWrap3D(s, t, r int32)

SetWrap3D sets the behavior at the 3D texure borders

func (*Texture) Unbind

func (tex *Texture) Unbind()

Unbind makes the texture unavailable for reading.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL