Skip to main content

XR8.GlTextureRenderer.fillTextureViewport()

XR8.GlTextureRenderer.fillTextureViewport(srcWidth, srcHeight, destWidth, destHeight)

Description

Convenience method for getting a Viewport struct that fills a texture or canvas from a source without distortion. This is passed to the render method of the object created by XR8.GlTextureRenderer.create()

Parameters

ParameterTypeDescription
srcWidthNumberThe width of the texture you are rendering.
srcHeightNumberThe height of the texture you are rendering.
destWidthNumberThe width of the render target.
destHeightNumberThe height of the render target.

Returns

An object: { width, height, offsetX, offsetY }

PropertyTypeDescription
widthNumberThe width (in pixels) to draw.
heightNumberThe height (in pixels) to draw.
offsetXNumberThe minimum x-coordinate (in pixels) to draw to.
offsetYNumberThe minimum y-coordinate (in pixels) to draw to.