Skip to content
Alessandro Febretti edited this page May 20, 2016 · 5 revisions

module cyclops wraps cyclops::ProgramAsset

Represents a Gpu program source and its associated binary code.

Methods

Property Description
string name
string vertexShaderName
string fragmentShaderName
string geometryShaderName
bool embedded
string vertexShaderSource
string fragmentShaderSource
string geometryShaderSource
int geometryOutVertices
PrimitiveType geometryInput The primitive type of input elements to the geometry shader. Use the PrimitiveType enumeration
PrimitiveType geometryOutput The primitive type of output elements to the geometry shader. Use the PrimitiveType enumeration

Notes

The PrimitiveType enumeration supports the following values:

  • Points
  • Triangles
  • TriangleStrip
  • LineStrip

Example:

	# Create a program asset from vertex, fragment and geometry shader files.
	shaderPath = "modules/PointCloud/shaders";
	program = ProgramAsset()
	program.name = "points"
	program.vertexShaderName = shaderPath + "/Sphere.vert"
	program.fragmentShaderName = shaderPath + "/Sphere.frag"
	program.geometryShaderName = shaderPath + "/Sphere.geom"
	
	# Set some options for the geometry shader.
	program.geometryOutVertices = 4
	program.geometryInput = PrimitiveType.TriangleStrip
	program.geometryOutput = PrimitiveType.TriangleStrip
	
	# Load and compile the program. 
	scene.addProgram(program)

	# Create a sphere and apply the program
	sphere = SphereShape.create(1, 4)
	sphere.setEffect("points") # We use the same name as the program.
Clone this wiki locally