jit.gl.slab Reference

Process texture data

jit.gl.slab

Description

Generate, process and combine images efficiently using fragment shaders. Develop custom texture effects for processing on the graphics card.

Examples

Discussion

This object requires one argument: the name of a drawing context. A named drawing context is a named instance of a jit.window, jit.pwindow, or jit.matrix object that has an instance of the jit.gl.render object associated with it. Additionally it can reference the name of a jit.gl.node sub-context. This value may also be set via the OB3D drawto attribute. If no argument is present, the object is implicitly added to the first valid drawing context or sub-context found in the current patch or by searching up the patcher hierarchy.

Attributes

activeinput [int]

The current input used for texture and matrix messages (default = 0). Useful when calling input messages from Java or JavaScript.

adapt [int] (default: 1)

Enable adapt to input (default = 1). When enabled the texture output dimensions will match the input dimensions.

colormode [symbol]

Texture color mode (default = argb)

Possible values:

'argb'
'uyvy'

dim [2 ints]

The texture output dimensions when adapt is disabled (default = 256 256)

dimscale [2 floats]

The output dimension scaling factor of the output (default = 1 1). Useful for upsampling or downsampling texture output.
output.dim = input.dim*dimscale

file [symbol]

The shader description file (JXS) to use (default = none)

inputs [int]

Slab input count (default = 2)

out_name [32 symbols]

g/s(get)

Output texture name

outputs [int]

Number of texture outputs (default = 1). Texture outputs correspond to shader render targets. For an example of multiple render targets see mrt.slab.unpack

rect [4 floats]

Slab geometry rectangle (default = 0 0 1 1). The four values represent normalized coordinates for the left, bottom, right and top sides of the geometry rectangle. To flip the image horizontally use rect 1 0 0 1 or to flip vertically use rect 0 1 1 0 .

rectangle [int]

Enable texture rectangle mode on internal texture objects(default = 1). When enabled the internal GL texture is treated as a rectangular texture, and must be referenced using sampler2DRect and sampled using texture2DRect when sampled from a GLSL shader. When disabled the texture dimensions are upsampled to the nearest power of two value, and must be referenced and sampled using sampler2D and texture2D. Certain texture attributes and GLSL effects require rectangle mode disabled.

thru [int]

Enable thru mode (default = 1). When the flag is set, texture output is sent whenever input is received.

type [symbol]

The output texture data type (default = auto). When type is auto the type is set by the input texture or matrix type.

Possible values:

'auto' ( Adapt to input data type )
'char' ( 8bit unsigned byte )
'long' ( 32bit integer )
'half' ( 16bit float )
'float' ( 32bit float )
'float16' ( 16bit float )
'float32' ( 32bit float )

Common Box Attributes

OB3D Attributes

Messages

(drag)

Dragging a JXS file from the Max File Browser or desktop to a jit.gl.slab object, will load the file.

(mouse)

Double click to open the shader editor. If no file is loaded the editor will load a starter shader to use as the basis for a new shader. This file must be saved to disk for use after the editor is closed.

getparamdefault

Arguments

name [symbol]
Report slab shader parameter's default value

getparamdescription

Get a parameter description

getparamlist

Report slab shader parameter names

getparamtype

Arguments

name [symbol]
Report slab shader parameter's type

getparamval

Arguments

name [symbol]
Report slab shader parameter's value

open

Opens the shader editor. If no file is loaded the editor will load a starter shader to use as the basis for a new shader. This file must be saved to disk for use after the editor is closed.

param

Arguments

name [symbol]
message [symbol]
values [list]
Set a slab shader parameter value

read

Arguments

filename [symbol]
Loads the given JXS shader file from disk.

sendinput

Arguments

index [int]
message [symbol]
values [list]
Sends a message to an input texture. If the first arg is an int, it specifies the texture index to send the message, otherwise all input textures receive the message.

sendoutput

Arguments

message [symbol]
values [list]
Sends the output jit.gl.texture objects a message.

sendshader

Arguments

message [symbol]
values [list]
Sends the internal jit.gl.shader object a message

OB3D Messages

See Also

Name Description
Working with OpenGL Working with OpenGL
Video and Graphics Programming Tutorials Video and Graphics Programming Tutorials
jit.gl.graph
jit.gl.gridshape
jit.gl.handle
jit.gl.isosurf
jit.gl.mesh
jit.gl.model
jit.gl.nurbs
jit.gl.plato
jit.gl.render
jit.gl.shader
jit.gl.sketch
jit.gl.text2d
jit.gl.text3d
jit.gl.texture
jit.gl.videoplane
jit.gl.volume
Tutorial 42: Slab: Data Processing on the GPU Tutorial 42: Slab: Data Processing on the GPU
External Text Editor External Text Editor