Module Expr Str Import alias identifier ImportFrom alias ImportFrom alias Assign NameStore Str Assign NameStore Str ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword TupleLoad Num Num keyword Str keyword Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Num Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad keyword ListLoad TupleLoad Str AttributeLoad NameLoad attr Num TupleLoad Str AttributeLoad NameLoad attr Num TupleLoad Str AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Num AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Str attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Num AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Str attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Num AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Num Expr Call AttributeLoad NameLoad attr Num Num Num Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr Num Num AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr Num Num AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body AugAssignAdd AttributeStore NameLoad attr BinOpDiv Num Num If CompareGt AttributeLoad NameLoad attr Num body Expr Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr Num Num Num attr AttributeLoad NameLoad attr Assign SubscriptStore NameLoad Index Num BinOpDiv Num BinOpPow NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Num Num Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str Call AttributeLoad AttributeLoad NameLoad attr attr Num Num TupleLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index Str Call AttributeLoad AttributeLoad NameLoad attr attr Num Num TupleLoad NameLoad Num Assign SubscriptStore AttributeLoad NameLoad attr Index Str Call AttributeLoad AttributeLoad NameLoad attr attr Num Num TupleLoad NameLoad Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list If CompareEq NameLoad Str body Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr
N/A N/A 
Example demonstrating simulation of fireworks using point sprites.
(adapted from the "OpenGL ES 2.0 Programming Guide")

This example demonstrates a series of explosions that last one second. The
visualization during the explosion is highly optimized using a Vertex Buffer
Object (VBO). After each explosion, vertex data for the next explosion are
calculated, such that each explostion is unique.
 N/A numpy np vispy app vispy.gloo gl N/A vertex_code 
#version 120

uniform float time;
uniform vec3 center;
attribute float lifetime;
attribute vec3 start;
attribute vec3 end;
varying float v_lifetime;
void main () {
    if (time < lifetime) {
        gl_Position.xyz = start + (time * end) + center;
        gl_Position.w = 1.0;
        gl_Position.y -= 1.5 * time * time;
    } else {
        gl_Position = vec4(-1000, -1000, 0, 0);
    }
    v_lifetime = clamp(1.0 - (time / lifetime), 0.0, 1.0);
    gl_PointSize = (v_lifetime * v_lifetime) * 40.0;
}
 N/A fragment_code 
#version 120

uniform vec4 color;
varying float v_lifetime;
void main()
{
    float d = 1 - length(gl_PointCoord - vec2(.5,.5)) / (sqrt(2)/2);
    gl_FragColor = d*color;
    gl_FragColor.a = d;
    gl_FragColor.a *= v_lifetime;
}
 Canvas N/A N/A app Canvas N/A __init__ N/A N/A self N/A N/A N/A N/A N/A N/A app Canvas __init__ self size N/A 800 600 title GL Fireworks keys interactive N/A on_initialize N/A N/A self event N/A N/A N/A N/A self program N/A N/A gl glCreateProgram N/A vertex N/A N/A gl glCreateShader N/A gl GL_VERTEX_SHADER N/A fragment N/A N/A gl glCreateShader N/A gl GL_FRAGMENT_SHADER N/A N/A N/A gl glShaderSource vertex vertex_code N/A N/A N/A gl glShaderSource fragment fragment_code N/A N/A N/A gl glCompileShader vertex N/A N/A N/A gl glCompileShader fragment N/A N/A N/A gl glAttachShader N/A self program vertex N/A N/A N/A gl glAttachShader N/A self program fragment N/A N/A N/A gl glLinkProgram N/A self program N/A N/A N/A gl glDetachShader N/A self program vertex N/A N/A N/A gl glDetachShader N/A self program fragment N/A N/A N/A gl glUseProgram N/A self program N/A n 10000 N/A N/A self data N/A N/A np zeros n dtype N/A N/A lifetime N/A np float32 1 N/A start N/A np float32 3 N/A end N/A np float32 3 N/A vbuffer N/A N/A gl glCreateBuffer N/A N/A N/A gl glBindBuffer N/A gl GL_ARRAY_BUFFER vbuffer N/A N/A N/A gl glBufferData N/A gl GL_ARRAY_BUFFER N/A self data N/A gl GL_DYNAMIC_DRAW N/A stride N/A N/A N/A self data strides N/A 0 N/A offset 0 N/A loc N/A N/A gl glGetAttribLocation N/A self program lifetime N/A N/A N/A gl glEnableVertexAttribArray loc N/A N/A N/A gl glVertexAttribPointer loc 1 N/A gl GL_FLOAT False stride offset N/A offset N/A N/A N/A N/A self data dtype N/A lifetime itemsize N/A loc N/A N/A gl glGetAttribLocation N/A self program start N/A N/A N/A gl glEnableVertexAttribArray loc N/A N/A N/A gl glVertexAttribPointer loc 3 N/A gl GL_FLOAT False stride offset N/A offset N/A N/A N/A N/A self data dtype N/A start itemsize N/A loc N/A N/A gl glGetAttribLocation N/A self program end N/A N/A N/A gl glEnableVertexAttribArray loc N/A N/A N/A gl glVertexAttribPointer loc 3 N/A gl GL_FLOAT False stride offset N/A N/A self elapsed_time 0 N/A N/A N/A gl glClearColor 0 0 0 1 N/A N/A N/A gl glDisable N/A gl GL_DEPTH_TEST N/A N/A N/A gl glEnable N/A gl GL_BLEND N/A N/A N/A gl glBlendFunc N/A gl GL_SRC_ALPHA N/A gl GL_ONE N/A N/A N/A gl glEnable 34370 N/A N/A N/A gl glEnable 34913 N/A N/A N/A gl glViewport 0 0 N/A self physical_size N/A N/A N/A self new_explosion N/A N/A self timer N/A N/A app Timer auto N/A self on_timer start True N/A on_draw N/A N/A self event N/A N/A N/A N/A N/A gl glClear N/A N/A gl GL_COLOR_BUFFER_BIT N/A gl GL_DEPTH_BUFFER_BIT N/A N/A N/A gl glDrawArrays N/A gl GL_POINTS 0 N/A len N/A self data N/A on_resize N/A N/A self event N/A N/A N/A N/A N/A gl glViewport 0 0 N/A event physical_size N/A on_timer N/A N/A self event N/A N/A N/A N/A self elapsed_time N/A 1.0 60.0 N/A N/A N/A self elapsed_time 1.5 N/A N/A N/A N/A self new_explosion N/A N/A self elapsed_time 0.0 N/A loc N/A N/A gl glGetUniformLocation N/A self program time N/A N/A N/A gl glUniform1f loc N/A self elapsed_time N/A N/A N/A self update N/A new_explosion N/A N/A self N/A N/A N/A n N/A len N/A self data N/A color N/A N/A N/A N/A N/A np random uniform 0.1 0.9 4 astype N/A np float32 N/A N/A color N/A 3 N/A 1.0 N/A n 0.08 N/A loc N/A N/A gl glGetUniformLocation N/A self program color N/A N/A N/A gl glUniform4f loc color N/A center N/A N/A N/A np random uniform -0.5 0.5 3 N/A loc N/A N/A gl glGetUniformLocation N/A self program center N/A N/A N/A gl glUniform3f loc center N/A N/A N/A self data N/A lifetime N/A N/A N/A np random normal 2.0 0.5 N/A n N/A N/A N/A self data N/A start N/A N/A N/A np random normal 0.0 0.2 N/A n 3 N/A N/A N/A self data N/A end N/A N/A N/A np random normal 0.0 1.2 N/A n 3 N/A N/A N/A gl glBufferData N/A gl GL_ARRAY_BUFFER N/A self data N/A gl GL_DYNAMIC_DRAW N/A N/A N/A N/A __name__ __main__ N/A N/A c N/A Canvas N/A N/A N/A c show N/A N/A N/A app run