Clean up some duplication
[factor/jcg.git] / extra / bunny / fixed-pipeline / fixed-pipeline.factor
blob0791773ba74107abf337a27e90e8712d6ff7f52f
1 USING: alien.c-types continuations destructors kernel
2 opengl opengl.gl bunny.model specialized-arrays.float
3 accessors ;
4 IN: bunny.fixed-pipeline
6 TUPLE: bunny-fixed-pipeline ;
8 : <bunny-fixed-pipeline> ( gadget -- draw )
9     drop
10     bunny-fixed-pipeline new ;
12 M: bunny-fixed-pipeline draw-bunny
13     drop
14     GL_LIGHTING glEnable
15     GL_LIGHT0 glEnable
16     GL_COLOR_MATERIAL glEnable
17     GL_LIGHT0 GL_POSITION float-array{ 1.0 -1.0 1.0 1.0 } underlying>> glLightfv
18     GL_FRONT_AND_BACK GL_SHININESS 100.0 glMaterialf
19     GL_FRONT_AND_BACK GL_SPECULAR glColorMaterial
20     GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE glColorMaterial
21     0.6 0.5 0.5 1.0 glColor4f
22     bunny-geom ;
24 M: bunny-fixed-pipeline dispose
25     drop ;