]> gitweb.factorcode.org Git - factor.git/blob - extra/bunny/fixed-pipeline/fixed-pipeline.factor
Specialized array overhaul
[factor.git] / extra / bunny / fixed-pipeline / fixed-pipeline.factor
1 USING: alien.c-types continuations destructors kernel
2 opengl opengl.gl bunny.model specialized-arrays accessors ;
3 SPECIALIZED-ARRAY: float
4 IN: bunny.fixed-pipeline
5
6 TUPLE: bunny-fixed-pipeline ;
7
8 : <bunny-fixed-pipeline> ( gadget -- draw )
9     drop
10     bunny-fixed-pipeline new ;
11
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 ;
23
24 M: bunny-fixed-pipeline dispose
25     drop ;
26