Module ncine.viewport

The table containing viewport related functions

Functions

ncine.viewport.new () Constructs a viewport object.
ncine.viewport.delete (viewport) Destroys a viewport object and releases its memory
ncine.viewport.get_type (viewport) Returns the viewport type
ncine.viewport.get_texture (viewport, index) Returns the texture at the specified viewport’s FBO color attachment index, if any
ncine.viewport.set_texture (viewport, index, texture) Adds or removes a texture at the specified viewport’s FBO color attachment index
ncine.viewport.get_depth_stencil_format (viewport) Returns the depth and stencil format of the viewport’s FBO renderbuffer
ncine.viewport.set_depth_stencil_format (viewport, depth_stencil_format) Sets the depth and stencil format of the viewport’s FBO renderbuffer
ncine.viewport.remove_all_textures (viewport) Removes all textures and the depth stencil renderbuffer from the viewport’s FBO
ncine.viewport.get_width (viewport) Returns viewport’s FBO width or zero if no texture is present
ncine.viewport.get_height (viewport) Returns viewport’s FBO height or zero if no texture is present
ncine.viewport.get_num_color_attachments (viewport) Returns the number of color attachments of the viewport’s FBO
ncine.viewport.get_viewport_rect (viewport) Returns the OpenGL viewport rectangle
ncine.viewport.set_viewport_rect (viewport, rect) Sets the OpenGL viewport rectangle through a ncine.rect table
ncine.viewport.set_viewport_rect (viewport, x, y, w, h) Sets the OpenGL viewport rectangle through rectangle components
ncine.viewport.get_scissor_rect (viewport) Returns the OpenGL scissor test rectangle
ncine.viewport.set_scissor_rect (viewport, rect) Sets the OpenGL scissor test rectangle through a ncine.rect table
ncine.viewport.set_scissor_rect (viewport, x, y, w, h) Sets the OpenGL scissor test rectangle through rectangle components
ncine.viewport.get_culling_rect (viewport) Returns the rectangle for screen culling
ncine.viewport.get_last_frame_cleared (viewport) Returns the last frame this viewport was cleared
ncine.viewport.get_clear_mode (viewport) Returns the viewport clear mode
ncine.viewport.set_clear_mode (viewport, clear_mode) Sets the viewport clear mode
ncine.viewport.get_clear_color (viewport) Returns the viewport clear color as a ncine.color table
ncine.viewport.set_clear_color (viewport, clear_color) Sets the viewport clear color through a ncine.color table
ncine.viewport.set_clear_color (viewport, r, g, b, a) Sets the viewport clear color through color components
ncine.viewport.get_rootnode (viewport) Returns the root node
ncine.viewport.set_rootnode (viewport, rootnode) Sets or removes the root node
ncine.viewport.clear_chain () Clears the array of viewports to be drawn before the screen
ncine.viewport.push_back_chain (viewport) Pushes a viewport to the back of the array of viewports to be drawn before the screen
ncine.viewport.push_front_chain (viewport) Pushes a viewport to the front of the array of viewports to be drawn before the screen
ncine.viewport.get_camera (viewport) Returns the camera used for rendering
ncine.viewport.set_camera (viewport, camera) Sets the camera to be used for rendering
ncine.viewport.set_glframebuffer_label (viewport, label) Sets the OpenGL object label for the viewport framebuffer object

Tables

viewportObj The light user data of a viewport object
ncine.viewport_type Viewport types (enumeration)
ncine.clear_mode Clear modes (enumeration)
ncine.depth_stencil_format Depth and stencil formats (enumeration)


Functions

ncine.viewport.new ()
Constructs a viewport object.

Don’t forget to call ncine.viewport.delete when you are done with it!

Returns:

    viewportObj A new viewport object
ncine.viewport.delete (viewport)
Destroys a viewport object and releases its memory

Parameters:

  • viewport viewportObj The viewport object to be destroyed
ncine.viewport.get_type (viewport)
Returns the viewport type

Parameters:

Returns:

    ncine.viewport_type
ncine.viewport.get_texture (viewport, index)
Returns the texture at the specified viewport’s FBO color attachment index, if any

Parameters:

Returns:

    ncine.texture.textureObj or nil
ncine.viewport.set_texture (viewport, index, texture)
Adds or removes a texture at the specified viewport’s FBO color attachment index

Parameters:

Returns:

    boolean True if a texture has been added or removed successfully
ncine.viewport.get_depth_stencil_format (viewport)
Returns the depth and stencil format of the viewport’s FBO renderbuffer

Parameters:

Returns:

    ncine.depth_stencil_format
ncine.viewport.set_depth_stencil_format (viewport, depth_stencil_format)
Sets the depth and stencil format of the viewport’s FBO renderbuffer

Parameters:

  • viewport viewportObj
  • depth_stencil_format ncine.depth_stencil_format

Returns:

    boolean True if a new depth and stencil format has been successfully set
ncine.viewport.remove_all_textures (viewport)
Removes all textures and the depth stencil renderbuffer from the viewport’s FBO

Parameters:

Returns:

    boolean True if the viewport is not the screen and all textures have been removed
ncine.viewport.get_width (viewport)
Returns viewport’s FBO width or zero if no texture is present

Parameters:

Returns:

    integer
ncine.viewport.get_height (viewport)
Returns viewport’s FBO height or zero if no texture is present

Parameters:

Returns:

    integer
ncine.viewport.get_num_color_attachments (viewport)
Returns the number of color attachments of the viewport’s FBO

Parameters:

Returns:

    integer
ncine.viewport.get_viewport_rect (viewport)
Returns the OpenGL viewport rectangle

Parameters:

Returns:

    ncine.rect
ncine.viewport.set_viewport_rect (viewport, rect)
Sets the OpenGL viewport rectangle through a ncine.rect table

Parameters:

ncine.viewport.set_viewport_rect (viewport, x, y, w, h)
Sets the OpenGL viewport rectangle through rectangle components

Parameters:

  • viewport viewportObj
  • x integer
  • y integer
  • w integer
  • h integer
ncine.viewport.get_scissor_rect (viewport)
Returns the OpenGL scissor test rectangle

Parameters:

Returns:

    ncine.rect
ncine.viewport.set_scissor_rect (viewport, rect)
Sets the OpenGL scissor test rectangle through a ncine.rect table

Parameters:

ncine.viewport.set_scissor_rect (viewport, x, y, w, h)
Sets the OpenGL scissor test rectangle through rectangle components

Parameters:

  • viewport viewportObj
  • x integer
  • y integer
  • w integer
  • h integer
ncine.viewport.get_culling_rect (viewport)
Returns the rectangle for screen culling

Parameters:

Returns:

    ncine.rect
ncine.viewport.get_last_frame_cleared (viewport)
Returns the last frame this viewport was cleared

Parameters:

Returns:

    integer
ncine.viewport.get_clear_mode (viewport)
Returns the viewport clear mode

Parameters:

Returns:

    ncine.clear_mode
ncine.viewport.set_clear_mode (viewport, clear_mode)
Sets the viewport clear mode

Parameters:

ncine.viewport.get_clear_color (viewport)
Returns the viewport clear color as a ncine.color table

Parameters:

Returns:

    ncine.color
ncine.viewport.set_clear_color (viewport, clear_color)
Sets the viewport clear color through a ncine.color table

Parameters:

ncine.viewport.set_clear_color (viewport, r, g, b, a)
Sets the viewport clear color through color components

Parameters:

  • viewport viewportObj
  • r number
  • g number
  • b number
  • a number
ncine.viewport.get_rootnode (viewport)
Returns the root node

Parameters:

Returns:

    ncine.scenenode.scenenodeObj or nil
ncine.viewport.set_rootnode (viewport, rootnode)
Sets or removes the root node

Parameters:

ncine.viewport.clear_chain ()
Clears the array of viewports to be drawn before the screen
ncine.viewport.push_back_chain (viewport)
Pushes a viewport to the back of the array of viewports to be drawn before the screen

Parameters:

ncine.viewport.push_front_chain (viewport)
Pushes a viewport to the front of the array of viewports to be drawn before the screen

Parameters:

ncine.viewport.get_camera (viewport)
Returns the camera used for rendering

Parameters:

Returns:

    ncine.camera.cameraObj or nil
ncine.viewport.set_camera (viewport, camera)
Sets the camera to be used for rendering

Parameters:

ncine.viewport.set_glframebuffer_label (viewport, label)
Sets the OpenGL object label for the viewport framebuffer object

Parameters:

Tables

viewportObj
The light user data of a viewport object
ncine.viewport_type
Viewport types (enumeration)

Fields:

  • WITH_TEXTURE
  • NO_TEXTURE
  • SCREEN
ncine.clear_mode
Clear modes (enumeration)

Fields:

  • EVERY_DRAW
  • EVERY_FRAME
  • THIS_FRAME_ONLY
  • NEXT_FRAME_ONLY
  • NEVER
ncine.depth_stencil_format
Depth and stencil formats (enumeration)

Fields:

  • NONE
  • DEPTH16
  • DEPTH24
  • DEPTH24_STENCIL8
generated by LDoc 1.5.0 Last updated 2024-12-18 15:08:56