Module display

Tables

texture Render using a texture.
mesh Render using a mesh.
gpux Render exclusively on the GPU.

Class Tesselator

tove.newAdaptiveTesselator (resolution[, recursionLimit]) Create an adaptive tesselator.
tove.newRigidTesselator (subdivisions) Create a rigid tesselator.


Tables

texture
Render using a texture. Also see the TÖVE Feature Matrix.

Fields:

See also:

Usage:

    graphics:setDisplay("texture")
mesh
Render using a mesh. If no tesselator is specified, a default tesselator will be chosen based on the configured usage of the Graphics. Also see the TÖVE Feature Matrix.

Fields:

  • mode string "mesh"
  • tesselator Tesselator, string or number tesselator to use or name of tesselator type or target size (optional)
  • args  ... configuration of tesselator (optional)

See also:

Usage:

    graphics:setDisplay("mesh") -- default configuration (based on configured usage)
    
    graphics:setDisplay("mesh", 1024) -- make it look good at a size of 1024 pixels
    -- will choose tesselation settings based on configured usage
    
    graphics:setDisplay("mesh", "rigid", 4) -- 4 subdivision levels (=2^4 points per curve)
    graphics:setDisplay("mesh", tove.newRigidTesselator(4)) -- same as above
    
    graphics:setDisplay("mesh", "adaptive", 1024) -- target a size of 1024
    graphics:setDisplay("mesh", tove.newAdaptiveTesselator(1024)) -- same as above
gpux
Render exclusively on the GPU. "gpux" means "gpu exclusive": this mode will implicitly render all curve geometry on the fly on the GPU. This has considerable resolution until it breaks down, however it can also be quite expensive in terms of performance (note also that it needs one GL context change per path). It is quite experimental as well: TÖVE is - to the best of my knowledge - the first library capable of rendering complex cubic bezier shapes inside GLSL shaders without doing some kind of tesselation. The only other existing implementation with this kind of approach seems to be NVidia™'s GPU Accelerated Path Rendering. Also see the TÖVE Feature Matrix.

Fields:

  • mode string "gpux"
  • lineRenderer string line shader ("fragment" or "vertex"). use "fragment" for lines that need to have round edges, use "vertex" for lines that need to have miters. You can use demos/editor to get an idea of the differences of this setting for various geometries. (default "fragment")
  • lineQuality  number line quality (between 0 and 1). Higher numbers are slower ("fragment" lines) or generate more geometry ("vertex" lines). (default 1)

See also:

Usage:

    graphics:setDisplay("gpux")
    graphics:setDisplay("gpux", "vertex")  -- use vertex shader for line drawing

Class Tesselator

tove.newAdaptiveTesselator (resolution[, recursionLimit])
Create an adaptive tesselator. Use this for high quality static graphics content that does not animate its shape in realtime. Adaptive Tesselators create meshes that give more subdivision (i.e. points and triangles) to areas where higher detail is needed, whereas other areas might get less subdivision. The number of vertices produced by Adaptive Tesselators depends on the specific geometry. They are not suited for shape animation, as each shape change would result in a different number of vertices and triangles.

Parameters:

  • resolution number resolution at which the mesh should look good
  • recursionLimit int maximum number of recursions during subdivision (optional)
tove.newRigidTesselator (subdivisions)
Create a rigid tesselator. Use this to obtain low or medium quality meshes that can distort and animate their shapes in realtime. Rigid tesselators subdivide geometry using fixed steps and thus produce a fixed number of vertices. As an effect, all areasy of the geometry receive the same level of detail and subdivision. They are suited for shape animation, as the vertex count stays constant and underlying meshes can be updated efficiently.

Parameters:

  • subdivisions int number of recursive subdivisions; 3 means 2^3=8 points for each bezier curve, 4 indicates 2^4=16 points, and so on.
generated by LDoc 1.4.6 Last updated 2019-04-19 11:25:52