MeshPainterScript

From K-3D

(Difference between revisions)
Jump to: navigation, search
(ENH: Adding 0.7 plugin docs)
Line 1: Line 1:
{{Plugin/MeshPainterScript}}
{{Plugin/MeshPainterScript}}
 +
 +
== Overview ==
 +
 +
MeshPainterScript can be used to do arbitrary rendering of a mesh under script control.  For example, the following script renders mesh points as blue dots:
 +
 +
<pre>
 +
#python
 +
 +
from OpenGL.GL import *
 +
 +
glPushAttrib(GL_ALL_ATTRIB_BITS)
 +
glDisable(GL_LIGHTING)
 +
glPointSize(5)
 +
glColor3d(0, 0, 1)
 +
 +
glBegin(GL_POINTS)
 +
for point in Mesh.points():
 +
glVertex3d(point[0], point[1], point[2])
 +
glEnd()
 +
 +
glPopAttrib()
 +
</pre>
 +
 +
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

Revision as of 01:47, 4 June 2007

Template:Plugin/MeshPainterScript

Overview

MeshPainterScript can be used to do arbitrary rendering of a mesh under script control. For example, the following script renders mesh points as blue dots:

#python

from OpenGL.GL import *

glPushAttrib(GL_ALL_ATTRIB_BITS)
glDisable(GL_LIGHTING)
glPointSize(5)
glColor3d(0, 0, 1)

glBegin(GL_POINTS)
for point in Mesh.points():
	glVertex3d(point[0], point[1], point[2])
glEnd()

glPopAttrib()

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

Personal tools