Hardware Acceleration with OpenGL in Squeak

This version has been updated to work with Squeak 3.x. There are a few bug fixes and loading models is ~7x faster but other then that there are no major changes.

WINDOWS PLATFORM ONLY!

OpenGL3.zip

The ZIP file should be extracted to the squeak directory

This code has been tested with Squeak 3.1 and uses the foreign function interface to call OpenGL. NOTE: Your video card must support the full OpenGL specs for hardware acceleration. (it has been tested with a TNT Vanta 8mb and TNT2 32mb)




Screen shots from CCTeamRally game in Squeak


CCTeamRally is a 3D multi-player car racing game.

To play CCTeamRally:

CCTeamRally new

Press escape to end the game.

The two cars are adapted from free 3d models at WWW.3DCAFE.COM.
Read class comments for more information!





Screen shots from OpenGL 3D viewer in Squeak


I've included two types of views. One writes directly to the screen and the other to an ImageMorph. The latter is more fun ('cause you can turn it ;-) but is much slower.
You can open models from the file list.
To open either view from a system window use:

view := OpenGLView new openInWorld.

view := OpenGLViewMorph new openInWorld.
view := (OpenGLViewMorph extent:(200@200)) openInWorld.


The current version only supports 3d Studio Max and DirectX ascii formats (most 3d packages allow you to save objects in ascii format). The DirectX format looks nicer because it supports vertex normals.

You can load 3d Studio Max and DirectX ascii formats (.asc and .X) with:

car := OpenGLRead fileNamed:'CCcar1.x'.

You can also open 3d objects by right clicking on the file in the file list.


To add or remove an object to a view use:

view add:car.
view remove:car.


I've added (and removed) a few halo handles for rotation and zooming. Have fun!

Wiebe Baron