hxn

GpuSurface

A window or the web page's canvas, which a device renders frames into and presents. Configure it with a size, then for each frame render into currentTexture() and call present(). Configure it again when the window is resized.

Properties

final target:SurfaceTarget
var format(default, null):TextureFormat
var width(default, null):Int
var height(default, null):Int
var vsync(default, null):Bool

Whether present waits for the display's refresh.

Methods

function preferredFormat():TextureFormat

The format this surface presents best, which configure uses by default.

function configure(width:Int, height:Int, ?format:TextureFormat, ?vsync:Bool = true):Void

Sets the size of the frames, in pixels, and their format; again after a resize.

function currentTexture():Texture

The texture of the frame being drawn, which a render pass renders into. It is the same texture until present.

function present():Void

Shows the current frame, after the work submitted before.