jit.gl.camera Reference

Set a rendering view

jit.gl.camera

Description

Sets the properties needed to define a view in OpenGL. These include field of view, clipping planes, and perspective or orthographic projection modes. In addition a position and orientation can be defined for a virtual camera in 3D space, and the proper view will be generated from these transforms.

Examples

Discussion

Multiple jit.gl.camera objects can be added to a single drawing context, and switched between using the enable attribute.

Jit.gl.camera can override standard OB3D attributes of objects in the context it is drawing to. For example setting poly_mode on the jit.gl.camera will override the current value of poly_mode on every OB3D for that camera's draw pass. To reset this action send the attribute name with no arguments.

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

adapt [int]

Adapt the capture texture dimensions to the context window size (default = 1).

capture [int]

Capture to the internal texture (default = 0).

Possible Values:

0 = disabled. Rendering is performed according to the parent context, which can be a jit.gl.node or a jit.gl.render object.
1 = enabled. Rendering is captured to a texture and the texture name is output out the left outlet.
> 1 = outputs multiple render targets (mrt) to the left outlet in the format "jit_gl_texture <texture_name> <texture_name>".

colormask [4 ints]

Color mask values for red, green, blue, and alpha channels. When set to 0, the corresponding color component is ignored by OpenGL. See glColorMask for more detail.

dim [2 ints]

Capture texture dimensions, used when adapt = 0 (default = 256 256).

direction [3 floats]

Direction

drawto [symbol]

Drawing context

erase_color [4 floats]

Background color of viewport and capture texture (default = 0.2 0.2 0.2 1.). Not compatible with non-automatic mode objects.

far_clip [float]

The far clipping plane distance in 3D world (default = 100.)

frustum [6 floats]

Camera frustum values (left, right, bottom, top, near, far). projection_mode must be set to frustum for these values to have an effect. The camera's frustum values entirely specify the geometry of the viewing frustum. For more technical documentation on what the six parameters to the frustum attribute mean, see the OpenGL documentation for glFrustum

fsaa [int]

Enable full screen anti-aliasing on the texture targets when capture is enabled (default = 0)

lens_angle [float]

The lens angle of the OpenGL camera (default = 45.)

locklook [int]

Force the camera to remain pointed at the lookat value, ignoring orientation messages and attributes (default = 0).

lookat [3 floats]

3D position at which the camera is pointed (default = 0. 0. 0.)

near_clip [float]

The near clipping plane distance in 3D world (default = 0.1)

ortho [int]

Orthographic projection mode (default = 0)

Possible values:

0 = 'Off (Perspective)' ( orthographic projection off (perspective projection) )
1 = 'Orthographic (Lens Angle)' ( orthographic projection on, using lens angle )
2 = 'Orthographic (No Lens Angle)' ( orthographic projection on, ignoring lens angle )

out_name [symbol]

Capture texture name

out_names [32 symbols]8.0.0

g/s(get)

Capture texture name list. The list length is equal to the number of capture targets enabled.

proj_matrix [16 floats]7.0.0

g/s(get)

Current projection matrix

projection_mode [symbol]

Camera projection mode sets how the projection matrix is generated. In standard mode, the camera uses the ortho setting an related attributes such as near, far, lens_angle, etc. to generate the projection matrix. In frustum mode, only the frustum attribute is used to calculate the projection matrix.

Possible values:

'standard'
'frustum'

tripod [int]

Force the camera to orient itself as if mounted on a tripod. Y-axis turn values are applied in world-space regardless of animmode (default = 0).

type [symbol]

Capture texture type (default = auto)

Possible values:

'auto' ( 8bit unsigned byte )
'char' ( 8bit unsigned byte )
'long' ( 32bit integer )
'half' ( 16bit float )
'float' ( 32bit float )
'float16' ( 16bit float )
'float32' ( 32bit float )

view_matrix [16 floats]7.0.0

g/s(get)

Current view matrix

viewport [4 floats]

Viewport coordinates which set the left, bottom, width, and height of the viewport (default = 0. 0. 1. 1.)

viewproj_matrix [16 floats]7.0.0

g/s(get)

Current view projection matrix

vp_mode [symbol]

Viewport coordinate mode (default = normalized). Determines if the viewport values are absolute or normalized coordinates.

Possible values:

'normalized'
'absolute'

Common Box Attributes

OB3D Attributes

Messages

getviewportray

Arguments

screen-x [int]
screen-y [int]
Return 6 values representing the world-space endpoints of a ray cast from the screen-x and screen-y arguments.

sendoutput

Arguments

message [symbol]
values [list]
Send messages to the internal texture objects used for capture output

OB3D Messages

See Also

Name Description
Working with OpenGL Working with OpenGL
Video and Graphics Programming Tutorials Video and Graphics Programming Tutorials
jit.gl.render
jit.gl.sketch
jit.anim.node
jit.anim.drive