-
Notifications
You must be signed in to change notification settings - Fork 1
/
Fl_Glut01_no.nim
56 lines (45 loc) · 1.17 KB
/
Fl_Glut01_no.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef __FB_ARM__
import fltk_main
import fltk_gl
proc ReshapeFunc (w: long, h: long) {.cdecl.}=
if (w<1) or (h<1) :
return
glViewport(0,0,w,h)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
# replacement for gluPerspective
Perspective(60.0,w/h,0.1,1000.0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
proc DisplayFunc() {.cdecl.}=
var init{.global.}: bool = false
if init == false :
glEnable(GL_DEPTH_TEST)
glEnable(GL_LIGHTING)
glEnable(GL_LIGHT0)
glEnable(GL_COLOR_MATERIAL)
glClearColor(0,.5,.5,1)
glColor3f(.75,.5,0)
init = true
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glPushMatrix()
glTranslatef(0,0,-1.5)
#GlutSolidSphere(.5,24,24)
GlutSolidTeapot(.5)
#GlutSolidTorus .1,.6,16,50
#GlutSolidCube 1
glPopMatrix()
glFlush()
#
# main
#
Fl_GlutInit() # helper it calls GluInit(@argc,@argv)
GlutInitDisplayMode(GLUT_RGB or GLUT_DOUBLE or GLUT_DEPTH)
GlutCreateWindow("Fl_Glut_Window01.bas")
GlutDisplayFunc(DisplayFunc)
GlutReshapeFunc(ReshapeFunc)
GlutShowWindow()
GlutMainLoop() # same: Fl_Run
#else
#print Ignored on ARM platform !
#endif # __FB_ARM__