3 GLSphereApp
:= 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, -3)
24 glRotated(angleX
, 1, 0, 0)
25 glRotated(angleY
, 0, 1, 0)
29 glDisable(GL_LIGHTING
)
30 glColor4d(.4,.4,.4, 1)
39 mouse
:= method(button
, state
, x
, y
,
44 motion
:= method(x
, y
,
45 angleX
= angleX
+ (y
- lastY
)
46 angleY
= angleY
+ (x
- lastX
)
53 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH
)
54 glutInitWindowSize(512, 512)
55 glutInit
; glutCreateWindow("Io Sphere")
62 glClearColor(1, 1, 1, 1)
63 glEnable(GL_DEPTH_TEST
)
66 glDisable(GL_CULL_FACE
)
69 glBlendFunc(GL_SRC_ALPHA
, GL_ONE_MINUS_SRC_ALPHA
)
70 glEnable(GL_LINE_SMOOTH
)
71 glHint(GL_LINE_SMOOTH_HINT
, GL_NICEST
)
74 self sphere
:= GLUSphere clone do(