ebiten: github.com/hajimehoshi/ebiten/internal/graphicscommand Index | Files

package graphicscommand

import "github.com/hajimehoshi/ebiten/internal/graphicscommand"

Package graphicscommand represents a low layer for graphics using OpenGL.


Package Files

command.go doc.go image.go shader.go thread.go

func FlushCommands Uses

func FlushCommands() error

FlushCommands flushes the command queue.

func MaxImageSize Uses

func MaxImageSize() int

MaxImageSize returns the maximum size of an image.

func NeedsRestoring Uses

func NeedsRestoring() bool

func ResetGraphicsDriverState Uses

func ResetGraphicsDriverState() error

ResetGraphicsDriverState resets or initializes the current graphics driver state.

func SetGraphicsDriver Uses

func SetGraphicsDriver(driver driver.Graphics)

func SetMainThread Uses

func SetMainThread(thread Thread)

type Image Uses

type Image struct {
    // contains filtered or unexported fields

Image represents an image that is implemented with OpenGL.

func NewImage Uses

func NewImage(width, height int) *Image

NewImage returns a new image.

Note that the image is not initialized yet.

func NewScreenFramebufferImage Uses

func NewScreenFramebufferImage(width, height int) *Image

func (*Image) Dispose Uses

func (i *Image) Dispose()

func (*Image) DrawTriangles Uses

func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, offsets [graphics.ShaderImageNum - 1][2]float32, vertices []float32, indices []uint16, clr *affine.ColorM, mode driver.CompositeMode, filter driver.Filter, address driver.Address, dstRegion, srcRegion driver.Region, shader *Shader, uniforms []interface{})

DrawTriangles draws triangles with the given image.

The vertex floats are:

0: Destination X in pixels
1: Destination Y in pixels
2: Source X in pixels (not texels!)
3: Source Y in pixels
4: Color R [0.0-1.0]
5: Color G
6: Color B
7: Color Y

src and shader are exclusive and only either is non-nil.

The elements that index is in between 2 and 7 are used for the source images. The source image is 1) src argument if non-nil, or 2) an image value in the uniform variables if it exists. If there are multiple images in the uniform variables, the smallest ID's value is adopted.

If the source image is not specified, i.e., src is nil and there is no image in the uniform variables, the elements for the source image are not used.

func (*Image) Dump Uses

func (i *Image) Dump(path string, blackbg bool) error

Dump dumps the image to the specified path. In the path, '*' is replaced with the image's ID.

If blackbg is true, any alpha values in the dumped image will be 255.

This is for testing usage.

func (*Image) InternalSize Uses

func (i *Image) InternalSize() (int, int)

func (*Image) IsInvalidated Uses

func (i *Image) IsInvalidated() bool

func (*Image) Pixels Uses

func (i *Image) Pixels() ([]byte, error)

Pixels returns the image's pixels. Pixels might return nil when OpenGL error happens.

func (*Image) ReplacePixels Uses

func (i *Image) ReplacePixels(pixels []byte, x, y, width, height int)

func (*Image) Sync Uses

func (i *Image) Sync() (<-chan struct{}, error)

Sync syncs the texture data in CPU and GPU so that Pixels can return the texture data immediately. In most cases, Sync doesn't have to be called explicitly. Even without Sync, Pixels should does Sync automatically, but this might take long.

Sync returns a channel that is closed when syncing finishes.

type Shader Uses

type Shader struct {
    // contains filtered or unexported fields

func NewShader Uses

func NewShader(ir *shaderir.Program) *Shader

func (*Shader) Dispose Uses

func (s *Shader) Dispose()

type Thread Uses

type Thread interface {
    Call(f func() error) error

Package graphicscommand imports 11 packages (graph) and is imported by 4 packages. Updated 2020-12-03. Refresh now. Tools for package owners.