1 USING: accessors kernel literals math opengl.demo-support
2 opengl.gl opengl.glu ui ui.gadgets ui.pixel-formats ui.render ;
5 TUPLE: nehe2-gadget < gadget ;
10 : <nehe2-gadget> ( -- gadget )
13 M: nehe2-gadget draw-gadget* ( gadget -- )
15 GL_PROJECTION glMatrixMode
17 45.0 width height / >float 0.1 100.0 gluPerspective
18 GL_MODELVIEW glMatrixMode
20 GL_SMOOTH glShadeModel
21 0.0 0.0 0.0 0.0 glClearColor
23 GL_DEPTH_TEST glEnable
25 GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
26 GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
28 -1.5 0.0 -6.0 glTranslatef
30 0.0 1.0 0.0 glVertex3f
31 -1.0 -1.0 0.0 glVertex3f
32 1.0 -1.0 0.0 glVertex3f
34 3.0 0.0 0.0 glTranslatef
36 -1.0 1.0 0.0 glVertex3f
37 1.0 1.0 0.0 glVertex3f
38 1.0 -1.0 0.0 glVertex3f
39 -1.0 -1.0 0.0 glVertex3f
44 { title "NeHe Tutorial 2" }
45 { pref-dim { $ width $ height } }
46 { pixel-format-attributes {
49 T{ depth-bits { value 16 } }
52 <nehe2-gadget> >>gadgets ;