<CsoundSynthesizer>
<CsOptions>

-+S -b1200 -+Om0

</CsOptions>
<CsInstruments>

	sr = 11025
	kr = 172.265625
	ksmps = 64
	nchnls = 1


idelay	init	8
	set_t_del	idelay

	GLfps	30

	GLpanel	"OpenGL panel", 1024, 300
	GLpanel_end
	FLrun

#include "OpenGL.h"

gi1	ftgen	1,0,256,19,1,1,0,1
gi2	ftgen	2,0,2048,10,1,0,0,0,.3,0,0,0,0,0,.1,0,0,0,0,0,0,0,.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,.1
gi3	ftgen	3,0,1024,10,1
	glMatrixMode	$GL_PROJECTION
	glLoadIdentity
	gluPerspective	80,.1,100
	glMatrixMode	$GL_MODELVIEW 
	glLoadIdentity
	glClearColor	0,0,0,1
	glEnable	$GL_DEPTH_TEST
	glEnable	$GL_COLOR_MATERIAL
	glEnable	$GL_LIGHT0
	glEnable  $GL_BLEND
	glBlendFunc	$GL_SRC_ALPHA, $GL_ONE_MINUS_SRC_ALPHA
	glEnable	$GL_CULL_FACE
;	glShadeModel $GL_FLAT
GLinsert_i $GL_NOT_VALID
	glClear	$GL_COLOR_BUFFER_BIT + $GL_DEPTH_BUFFER_BIT 
GLinsert_i 1


gimode	init	0

;///////////////////////////////////////////////////
	instr	1
;///////////////////////////////////////////////////


k1	oscili	1,.05,1,.75
k2	oscili	1,.023456,1
k3	oscili	1,.043215,1

t1	=	t(k1)
t2	=	t(k2)
t3	=	t(k3)

	glLineWidth t2*2 +1
	glLoadIdentity

GLinsert	1.02
	glRotate	t2*360,0,0,1

tj	=	-2

tmode	=	0
tbool	=	(tj <= 2)

	GLwhile	tbool
		tbool = (tj <= 2)
		glPushMatrix
		glTranslate	tj*1.5,(tj*1.5) ^ 4,0
		glRotate		t1*360,t2*360,0,1

		GLif (tmode % 2 == 0)
			glColor	t1*(2-tj) * .25+.5,t2*tj*.3+.5,1-t1+.5,.2
			glEnable $GL_LIGHTING

			GLif (tmode % 3 ==0)
				glutSphere sin((t1*tj*8))*2 ,3,2, 1
			GLelse
				glutSphere sin((t1*tj*8))*2 ,2,4, 1
			GLend_if
		GLelse
			glColor	t1*(2-tj) * .25,t2*tj*.3,1-t1,1
			glDisable $GL_LIGHTING
			glutSphere sin((t1*tj*8))*2 ,3,2, 0
		GLend_if
		tmode = tmode+1
		glPopMatrix
		tj = tj+.0625
	GLend_while


GLinsert	1.1
kenv	linseg	0,.1,1, p3-.3,1,.2,0
a1	oscili	10000*k1*kenv, 100*p4 * (1+k2*.1) , 2
	out	a1


	endin

;//////////////////////////////////////////////
	instr	2
;//////////////////////////////////////////////
k1	oscili	7,.03,gi3
k2	oscili	1,.07,gi3,.25
	gluLookAt 0,t(k1),-1,    t(k2),0,0,     0, 1,0

GLinsert	1.05

	endin




</CsInstruments>
<CsScore>

i2 1 3600
i1 2 3600 1 1.1
i1 6.123 10 1.505
i1 11.321 10 [1.5 * (2^(1/12))]
i1 21.321 10 [1.5 * (2^(1/12))]
i1 13.321 3600 [(2^(1/12))]


</CsScore>
</CsoundSynthesizer>
