3 GLCylinderApp
:= Object clone do(
11 reshape
:= method(w
, h
,
12 glMatrixMode(GL_PROJECTION
)
14 gluPerspective(45, w
/ h
, 1.0, 10.0)
15 glMatrixMode(GL_MODELVIEW
)
16 glViewport(0, 0, w
, h
)
20 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT
)
23 glTranslated(0, 0, -5)
24 glRotated(angleX
, 1, 0, 0)
25 glRotated(angleY
, 0, 1, 0)
27 glTranslated(0, 0, -1.5)
32 glDisable(GL_LIGHTING
)
33 glColor4d(.4,.4,.4, 1)
42 mouse
:= method(button
, state
, x
, y
,
47 motion
:= method(x
, y
,
48 angleX
= angleX
+ (y
- lastY
)
49 angleY
= angleY
+ (x
- lastX
)
56 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH
)
57 glutInitWindowSize(512, 512)
58 glutInit
; glutCreateWindow("Io Cylinder")
65 glClearColor(1, 1, 1, 1)
66 glEnable(GL_DEPTH_TEST
)
69 glDisable(GL_CULL_FACE
)
72 glBlendFunc(GL_SRC_ALPHA
, GL_ONE_MINUS_SRC_ALPHA
)
73 glEnable(GL_LINE_SMOOTH
)
74 glHint(GL_LINE_SMOOTH_HINT
, GL_NICEST
)
77 self cylinder
:= GLUCylinder clone do(
89 GLCylinderApp
clone run