[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
app[tinn8] khronos 1
"globals sanity check"
#( init onkeymouse display ontick onidle reshape ) do: [:selector| | callback |
callback := Smalltalk current globalAt: selector.
callback notNil ifTrue: [ self note: selector ,'=' ,callback ]
]
"App #1 - lesson2"
View3D
onInit: [ self note: #init.
# #glShadeModel: 16r1D01 "GL_SMOOTH".
# #glClearColor: 0 g: 0 b: 0 a: 0.5.
# #glClearDepth: 1.
# #glEnable: 16r0B71 "GL_DEPTH_TEST".
# #glDepthFunc: 16r0203 "GL_LEQUAL".
# #glHint: 16r0C50 value: 16r1102.
];
onKeyMouse: [:event| self note: event description ];
onDisplay: [ self note: #display.
# #glClear: 16r00004000 "GL_COLOR_BUFFER_BIT".
# #glClear: 16r00000100 "GL_DEPTH_BUFFER_BIT".
# #glLoadIdentity.
# #glTranslate:-1.5 y: 0 z:-6.
# #glBegin: 16r0004 "GL_TRIANGLES".
# #glVertex: 0 y: 1 z: 0.
# #glVertex:-1 y:-1 z: 0.
# #glVertex: 1 y:-1 z: 0.
# #glEnd.
# #glTranslate: 3 y: 0 z: 0.
# #glBegin: 16r0007 "GL_QUADS".
# #glVertex:-1 y: 1 z: 0.
# #glVertex: 1 y: 1 z: 0.
# #glVertex: 1 y:-1 z: 0.
# #glVertex:-1 y:-1 z: 0.
# #glEnd.
];
onTick: [:count| self note: #tic ,count ];
onIdle: [:seconds| self note: #idle ,seconds ];
onReshape: [:extent| self note: #reshape ,extent.
# #glViewport: 0 top: 0 width: extent x height: extent y.
# #glMatrixMode: 16r1701 "GL_PROJECTION".
# #glLoadIdentity.
# #gluPerspective: 45 ratio: extent x / extent y with: 0.1 with: 100.
# #glMatrixMode: 16r1700 "GL_MODELVIEW".
# #glLoadIdentity.
];
yourself.
Application current run: View3D main.
self note: 'GLWindow=' ,View3D window.