Packagestarling.rendering
Classpublic class Program
InheritanceProgram Inheritance Object

A Program represents a pair of a fragment- and vertex-shader.

This class is a convenient replacement for Stage3Ds "Program3D" class. Its main advantage is that it survives a context loss; furthermore, it makes it simple to create a program from AGAL source without having to deal with the assembler.

It is recommended to store programs in Starling's "Painter" instance via the methods registerProgram and getProgram. That way, your programs may be shared among different display objects or even Starling instances.

See also

Painter


Public Methods
 MethodDefined By
  
Program(vertexShader:ByteArray, fragmentShader:ByteArray)
Creates a program from the given AGAL (Adobe Graphics Assembly Language) bytecode.
Program
  
activate(context:Context3D = null):void
Activates the program on the given context.
Program
  
dispose():void
Disposes the internal Program3D instance.
Program
  
fromSource(vertexShader:String, fragmentShader:String, agalVersion:uint = 1):Program
[static] Creates a new Program instance from AGAL assembly language.
Program
Constructor Detail
Program()Constructor
public function Program(vertexShader:ByteArray, fragmentShader:ByteArray)

Creates a program from the given AGAL (Adobe Graphics Assembly Language) bytecode.

Parameters
vertexShader:ByteArray
 
fragmentShader:ByteArray
Method Detail
activate()method
public function activate(context:Context3D = null):void

Activates the program on the given context. If you don't pass a context, the current Starling context will be used.

Parameters

context:Context3D (default = null)

dispose()method 
public function dispose():void

Disposes the internal Program3D instance.

fromSource()method 
public static function fromSource(vertexShader:String, fragmentShader:String, agalVersion:uint = 1):Program

Creates a new Program instance from AGAL assembly language.

Parameters

vertexShader:String
 
fragmentShader:String
 
agalVersion:uint (default = 1)

Returns
Program