Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
GLMorphic
Last updated at 6:44 pm UTC on 24 August 2007
This page about project with codename 'GLMorphic', which uses OpenGL as backend to draw everything in squeak.

The primary goal of project is to integrate GLCanvas (subclass of Canvas) and GLDisplayScreen
into squeak morphic, to be able use OpenGL directly and avoid using software blitting for rendering at all.

At current stage, most basic canvas operations supported, and drawing speed is about 3 times faster when using hardware accelerated GL with morphic.

Using GL as back end for all drawing operations opens wide range perspective for morphic world. You can seamlessly use 2D/3D drawings for your morphs and create stunning 3D applications with little efforts and mix it with any existing 2D morphs to build UI for your applications. In fact, there's no difference is your morph 2D or 3D, since any morph can use GL calls directly to draw itself on screen. So there's no limits in what your morph can do. It can , for instance draw 3D meshs, or can apply special effects for own child morphs, like warping / texturing / color shifting e.t.c.
Everything which has OpenGL is under your total control. Of course this adds some danger, since you can damage OpenGL state when issuing wrong commands to it, but nevertheless you can gain much more - you can build 3D environments on the fly and use Morphic at the same time.

GLMorphic uses main squeak window and you don't need to create separate OS windows to draw your 3D stuff in it. This makes life much easier, since almost all UI in squeak used main window (pity, there's no support for multiple screens/desktops).

Installation


To install GLMorphic package you need do following steps:

http://www.squeaksource.com/GLMorphic.html

MCHttpRepository
location: 'http://www.squeaksource.com/GLMorphic'
user: ''
password: ''

I tested installation with Squeak3.10beta.7143 image.
But it can work with any 3.10 and 3.9 images(i hope).


Using


to enable OpenGL drawing do:
GLDisplayScreen new
to disable:
GLDisplayScreen uninstall

(if your screen freezes and don't draw anything press interrupt key: Alt-. ,
this causes to fallback to software blitting renderer)

To use GLCanvas without replacing display (mainly for debugging purposes), use:
GLDisplayScreen testCanvas.

For example, you can compare rendering performance by placing many morphs on the screen and then issuing:

[World fullDrawOn: GLDisplayScreen testCanvas] timeToRun
[World fullDrawOn: World assuredCanvas ] timeToRun

A performance is greatly depends on platform drivers/card capabilities.


Status


Of course, i implemented only basic functions and there are much things left to do. If you willing to help, feel free to upload patches to squeaksource repository.
Currently i have plugin only for windows, need help to port it on other platforms. You can find win32 plugin platform sources at http://sig.squeak.se/glplugin_win32_platform_files.zip