gl2

package module
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2014 License: BSD-3-Clause Imports: 17 Imported by: 0

README

Azul3D - gfx/gl2

This package provides an OpenGL 2.X based graphics renderer for Azul3D. The behavior of the renderer is fully defined by Azul3D's gfx package.

Version 2.0.1

  • Documentation
  • azul3d.org/gfx/gl2.v2
  • import "azul3d.org/gfx/gl2.v2"
  • Changes
  • Fixed a bug that caused MVP matrices to constantly be recalculated (see #22).

Version 2

  • Documentation
  • azul3d.org/gfx/gl2.v2
  • import "azul3d.org/gfx/gl2.v2"
  • Changes
  • Behavior is fully defined by the gfx.v2 package.
  • Added OS X support (see #14).
  • Added Better Debugging (see #12).
  • Switched to using Glow for generating OpenGL wrappers (see #11).

Version 1

Documentation

Overview

Package gl2 provides an OpenGL 2 based graphics renderer.

The behavior of the renderer is defined fully in the gfx package (as such this package only makes mention of strictly OpenGL related caveats like initialization, etc).

When performing render-to-texture (RTT), feedback loops are explicitly prohibited. This means that the renderer will panic if you attempt to draw an object to an RTT canvas when the object uses the literal RTT texture in itself. Through OpenGL the result of this is at best a corrupt image -- and at worst driver-level memory corruption (hence it is not allowed).

A texture can turn on and off mipmapped by setting it's minification filter to a mipmapped or non-mipmapped filter after the texture has been loaded, but mipmapped can only be turned on with a loaded texture if when it loaded it had a mipmapped minification filter set on it.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidVersion = errors.New("invalid OpenGL version; must be at least OpenGL 2.0")

Used when attempting to create an OpenGL 2.0 renderer in a lesser OpenGL context.

Functions

This section is empty.

Types

type Renderer

type Renderer struct {

	// Render and loader execution channels.
	RenderExec chan func() bool
	LoaderExec chan func()
	// contains filtered or unexported fields
}

Renderer is an OpenGL 2 based graphics renderer, it runs independant of the window management library being used (GLFW, SDL, Chippy, QML, etc).

The renderer primarily uses two independant OpenGL contexts, one is used for rendering and one is used for managing resources like meshes, textures, and shaders which allows for asynchronous loading (although it is also possible to use only a single OpenGL context for windowing libraries that do not support multiple, but this will inheritly disable asynchronous loading).

func New

func New(keepState bool) (*Renderer, error)

New returns a new OpenGL 2 based graphics renderer. If any error is returned then a nil renderer is also returned. This function must be called only when an OpenGL 2 context is active.

keepState specifies whether or not the existing graphics state should be maintained between frames. If set to true then before rendering a frame the graphics state will be saved, the frame rendered, and the old graphics state restored again. This is particularly useful when the renderer must cooperate with another renderer (e.g. QT5). Do not turn it on needlessly though as it does come with a performance cost.

func (Renderer) Bounds

func (c Renderer) Bounds() image.Rectangle

Implements the gfx.Canvas interface.

func (*Renderer) Clear

func (r *Renderer) Clear(rect image.Rectangle, bg gfx.Color)

Implements gfx.Canvas interface.

func (*Renderer) ClearDepth

func (r *Renderer) ClearDepth(rect image.Rectangle, depth float64)

Implements gfx.Canvas interface.

func (*Renderer) ClearStencil

func (r *Renderer) ClearStencil(rect image.Rectangle, stencil int)

Implements gfx.Canvas interface.

func (*Renderer) Clock

func (r *Renderer) Clock() *clock.Clock

Implements gfx.Renderer interface.

func (*Renderer) Download

func (r *Renderer) Download(rect image.Rectangle, complete chan image.Image)

Implements gfx.Downloadable interface.

func (*Renderer) Draw

func (r *Renderer) Draw(rect image.Rectangle, o *gfx.Object, c *gfx.Camera)

Implements gfx.Canvas interface.

func (*Renderer) GPUInfo

func (r *Renderer) GPUInfo() gfx.GPUInfo

Implements gfx.Renderer interface.

func (*Renderer) LoadMesh

func (r *Renderer) LoadMesh(m *gfx.Mesh, done chan *gfx.Mesh)

Implements gfx.Renderer interface.

func (*Renderer) LoadShader

func (r *Renderer) LoadShader(s *gfx.Shader, done chan *gfx.Shader)

Implements gfx.Renderer interface.

func (*Renderer) LoadTexture

func (r *Renderer) LoadTexture(t *gfx.Texture, done chan *gfx.Texture)

Implements gfx.Renderer interface.

func (Renderer) MSAA

func (c Renderer) MSAA() bool

Implements gfx.Canvas interface.

func (Renderer) Precision

func (c Renderer) Precision() gfx.Precision

Implements gfx.Canvas interface.

func (*Renderer) QueryWait

func (r *Renderer) QueryWait()

Implements gfx.Canvas interface.

func (*Renderer) Render

func (r *Renderer) Render()

Implements gfx.Canvas interface.

func (*Renderer) RenderToTexture

func (r *Renderer) RenderToTexture(cfg gfx.RTTConfig) gfx.Canvas

Implements gfx.Renderer interface.

func (*Renderer) SetDebugOutput

func (r *Renderer) SetDebugOutput(w io.Writer)

SetDebugOutput sets the writer, w, to write debug output to. It will mostly contain just shader debug information, but other information may be written in the future as well.

func (Renderer) SetMSAA

func (c Renderer) SetMSAA(msaa bool)

Implements gfx.Canvas interface.

func (*Renderer) UpdateBounds

func (r *Renderer) UpdateBounds(bounds image.Rectangle)

UpdateBounds updates the effective bounding rectangle of this renderer. It must be called whenever the OpenGL canvas size should change (e.g. on window resize).

Directories

Path Synopsis
internal
gl
Package gl implements Go bindings to OpenGL.
Package gl implements Go bindings to OpenGL.
procaddr
Package procaddr defines platform-specific mechanisms for loading OpenGL function addresses.
Package procaddr defines platform-specific mechanisms for loading OpenGL function addresses.
procaddr/auto
Package auto automatically selects an appropriate GetProcAddressFunc based on the build environment.
Package auto automatically selects an appropriate GetProcAddressFunc based on the build environment.

Jump to

Keyboard shortcuts

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