glutil

package
v0.0.0-...-afa8a11 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2015 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package glutil implements OpenGL utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateProgram

func CreateProgram(vertexSrc, fragmentSrc string) (gl.Program, error)

CreateProgram creates, compiles, and links a gl.Program.

Types

type Image

type Image struct {
	RGBA *image.RGBA
	// contains filtered or unexported fields
}

Image bridges between an *image.RGBA and an OpenGL texture.

The contents of the *image.RGBA can be uploaded as a texture and drawn as a 2D quad.

The number of active Images must fit in the system's OpenGL texture limit. The typical use of an Image is as a texture atlas.

func NewImage

func NewImage(w, h int) *Image

NewImage creates an Image of the given size.

Both a host-memory *image.RGBA and a GL texture are created.

func (*Image) Delete

func (img *Image) Delete()

Delete invalidates the Image and removes any underlying data structures. The Image cannot be used after being deleted.

func (*Image) Draw

func (img *Image) Draw(sz size.Event, topLeft, topRight, bottomLeft geom.Point, srcBounds image.Rectangle)

Draw draws the srcBounds part of the image onto a parallelogram, defined by three of its corners, in the current GL framebuffer.

func (*Image) Upload

func (img *Image) Upload()

Upload copies the host image data to the GL device.

Jump to

Keyboard shortcuts

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