hxn

Context

An OpenGL ES 3 context. Its methods are OpenGL ES's, called on the thread where it is current.

Static methods

function hxnAdopt(hxnRaw:Handle):Context

An object for a value the library returned.

Properties

var hxnRaw:Handle

Methods

function resizeWindow(width:Int, height:Int):Void

Sets the size of the window the default framebuffer is, where EGL takes it from the program rather than the window system: Wayland. Elsewhere it does nothing.

function makeCurrent():Void

Makes the context current on the calling thread.

function swapBuffers():Void

Presents the window's back buffer, for a context made with createWindowContext.

function swapInterval(interval:Int):Void

The number of vertical blanks swapBuffers waits for: 0 presents at once.

function renderer():String

GL_RENDERER.

function version():String

GL_VERSION.

function extensions():String

GL_EXTENSIONS, separated by spaces.

function error():Int

glGetError: 0, or the first error since the last call.

function createBuffer(target:BufferTarget, size:Int64, usage:Usage):Buffer

A buffer of size bytes, uninitialized, for target.

function createBufferWith(target:BufferTarget, bytes:Bytes, usage:Usage):Buffer

A buffer holding bytes, for target.

function createTexture(width:Int, height:Int, format:TextureFormat):Texture

A 2D texture of one level, with immutable storage.

function createSampler(min:Filter, mag:Filter, wrapS:Wrap, wrapT:Wrap):Sampler

A sampler with these filters and wrap modes.

function createProgram(vertex:String, fragment:String):Program

A program linked from GLSL ES 3.00 vertex and fragment sources. Compile and link errors are thrown with OpenGL ES's log.

function createVertexArray():VertexArray

An empty vertex array.

function createFramebuffer(color:Texture):Framebuffer

A framebuffer rendering into color. Throws unless it is complete.

function bindFramebuffer(framebuffer:Framebuffer):Void

Renders into framebuffer from now on.

function bindDefaultFramebuffer():Void

Renders into the window from now on.

function viewport(x:Int, y:Int, width:Int, height:Int):Void
function scissor(x:Int, y:Int, width:Int, height:Int):Void
function clear(bits:Int, r:Float, g:Float, b:Float, a:Float):Void

Clears the bound framebuffer's color, depth or stencil: bits are ClearBits or-ed together.

function useProgram(program:Program):Void
function bindVertexArray(vertexArray:VertexArray):Void
function bindUniformBuffer(index:Int, buffer:Buffer):Void

Binds buffer to uniform buffer binding point index.

function bindTexture(unit:Int, texture:Texture, sampler:Sampler):Void

Binds texture and sampler to texture unit unit.

function drawArrays(primitive:Primitive, first:Int, count:Int, instances:Int):Void

glDrawArraysInstanced.

function drawElements(primitive:Primitive, count:Int, kind:ComponentType, offset:Int, instances:Int):Void

glDrawElementsInstanced, with indices from the bound vertex array's element buffer, starting offset bytes in.

function readPixels(x:Int, y:Int, width:Int, height:Int):Bytes

The bound framebuffer's pixels in a rectangle, as 8-bit RGBA, bottom row first.

function flush():Void

glFlush.

function finish():Void

glFinish: returns when the GPU has finished every command so far.

function completed():Future<Unit>

Settles when the GPU has finished every command so far. It waits on an EGL fence from another thread; without EGL 1.5 and EGL_KHR_fence_sync it finishes here and is settled already.

function close():Void

Releases the native value now. The collector does it otherwise. Using this object afterwards throws.