[squeak-dev] Re: OpenGL into morphic ala lumiere?

Chris Cunnington smalltalktelevision at gmail.com
Thu Mar 25 16:02:58 UTC 2010


"is there some relatively simple way in Squeak to direct OGL drawing to a
morphic surface/canvas/thingie so it renders inside the boundaries of the
morph when moved?"

Download OpenCobalt. Take the code below and load it into that image to
create the class. Then go to CobaltWorldIntro>>initialize and add:

yum := TOglTestTriangle new.
space addChild: yum.

When you go to CobaltWorldIntro (which isn't the default) you'll wander
around and see a triangle. That OpenGL code is straight out of an OpenGL
book. The window will be easy to pick up and move around the greater Squeak
World. I don't think it uses Morphic, but a fusion of MVC and Morphic called
Tweak.

Chris

TFrame subclass: #TOglTestTriangle
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OpenCobalt-OpenGL-Test'!

!TOglTestTriangle methodsFor: 'render' stamp: 'jrd 3/13/2010 17:33'!
render: ogl

       ogl glBegin(GLTriangles).
       ogl glVertex3f(2.0, 2.5, -1.0).
       ogl glVertex3f(-3.5, -2.5, -1.0).
       ogl glVertex3f(2.0, -4.0, -1.0).
       ogl glEnd().
! !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100325/79a24d03/attachment.htm


More information about the Squeak-dev mailing list