4 // glcube
.io
- A simple Openprogram
5 // (C
) 2002 Mike Austin
7 // Set a simple namespace
9 GLCubeApp
:= Object clone do(
17 reshape
:= method(w
, h
,
18 glMatrixMode(GL_PROJECTION
)
20 gluPerspective(45, w
/ h
, 1.0, 10.0)
21 glMatrixMode(GL_MODELVIEW
)
22 glViewport(0, 0, w
, h
)
26 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
)
29 glTranslated(0, 0, -3);
30 glRotated(angleX
, 1, 0, 0)
31 glRotated(angleY
, 0, 1, 0)
34 glDisable(GL_LIGHTING
)
35 glColor4d(.4,.4,.4, 1)
43 mouse
:= method(button
, state
, x
, y
,
48 motion
:= method(x
, y
,
49 angleX
= angleX
+ (y
- lastY
)
50 angleY
= angleY
+ (x
- lastX
)
57 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH
)
58 glutInitWindowSize(512, 512)
59 glutInit
; glutCreateWindow("Io Cube")
66 glClearColor(1, 1, 1, 1)
67 glEnable(GL_DEPTH_TEST
)
70 glDisable(GL_CULL_FACE
)
73 glBlendFunc(GL_SRC_ALPHA
, GL_ONE_MINUS_SRC_ALPHA
)
74 glEnable(GL_LINE_SMOOTH
)
75 glHint(GL_LINE_SMOOTH_HINT
, GL_NICEST
)