GLRenderableScript

From K-3D

Jump to: navigation, search

Description

Scripted OpenGL Drawable
Plugin Status:Stable
Categories:All Plugins, Stable Plugins, OpenGL Plugins, Script Plugins

Metadata

Name Value

Properties

Label Description Type Script Name
Input Matrix Input matrix k3d::matrix4 input_matrix
Output Matrix Output Matrix k3d::matrix4 output_matrix
Viewport Visible Controls whether this node will be visibile in the viewport. k3d::bool_t viewport_visible
Script Script source code k3d::string_t script


Overview

DrawableScript can be used to do arbitrary drawing in a viewport under script control. For example, the following script renders a yellow square centered on the origin:

#python

try:
  from OpenGL.GL import *

  glDisable(GL_LIGHTING)
  glColor3f(1, 1, 0)

  glBegin(GL_POLYGON)
  glVertex3f(-1, -1, 0)
  glVertex3f(1, -1, 0)
  glVertex3f(1, 1, 0)
  glVertex3f(-1, 1, 0)
  glEnd()

except:
  print "Couldn't load OpenGL module"

Note that you must have OpenGL bindings installed for your script engine - Python in this case. On most platforms this is a separate download - check with your distribution on how to obtain PyOpenGL first, or visit http://pyopengl.sourceforge.net

Script Environment

The following parameters will be available to your script at runtime (see the documentation for your script engine for details on how these parameters can be accessed programmatically).

Name Description
Document A reference to the document that owns this node.
Node A reference to this node.
Personal tools