More than likely, this is way too advanced for moi, but I spent about an hour rummaging through the Lumiere code for Pharo and just couldn't grok how the OpenGL rendering is directed to a morph instead of to raw coordinates on the main window. Is there some special property of Pharo that allows this kind of thing, or 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?
Or does my question even make sense?
Thanks.
Lawson
On 3/25/2010 8:25 AM, Lawson English wrote:
More than likely, this is way too advanced for moi, but I spent about an hour rummaging through the Lumiere code for Pharo and just couldn't grok how the OpenGL rendering is directed to a morph instead of to raw coordinates on the main window. Is there some special property of Pharo that allows this kind of thing, or 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?
There is absolutely nothing to it. All you need is something like here:
MyMorph>>drawOn: aCanvas
"--- initialize opengl ---" ogl ifNil:[ ogl := OpenGL newIn: self bounds. ogl ifNil:[^super drawOn: aCanvas]. ] ifNotNil:[ ogl bufferRect: self bounds. ].
"--- when not rendering to Display, draw last captured frame ---" aCanvas form == Display ifFalse:[ ^aCanvas drawImage: ogl screenShot at: bounds origin. ].
"--- otherwise do normal scene rendering ---" ^self renderScene: ogl.
Cheers, - Andreas
Andreas Raab wrote:
On 3/25/2010 8:25 AM, Lawson English wrote:
More than likely, this is way too advanced for moi, but I spent about an hour rummaging through the Lumiere code for Pharo and just couldn't grok how the OpenGL rendering is directed to a morph instead of to raw coordinates on the main window. Is there some special property of Pharo that allows this kind of thing, or 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?
There is absolutely nothing to it. All you need is something like here:
MyMorph>>drawOn: aCanvas
[...]
That WAS easy. Is there a simple way to implement the c-like syntax you did for Cobalt? I'm working on recreating the HE tutorial series and many people will balk at the with:with:with:with: syntax, I'm afraid
Lawson
On 4/1/2010 4:19 PM, Lawson English wrote:
Andreas Raab wrote:
On 3/25/2010 8:25 AM, Lawson English wrote:
More than likely, this is way too advanced for moi, but I spent about an hour rummaging through the Lumiere code for Pharo and just couldn't grok how the OpenGL rendering is directed to a morph instead of to raw coordinates on the main window. Is there some special property of Pharo that allows this kind of thing, or 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?
There is absolutely nothing to it. All you need is something like here:
MyMorph>>drawOn: aCanvas
[...]
That WAS easy. Is there a simple way to implement the c-like syntax you did for Cobalt? I'm working on recreating the HE tutorial series and many people will balk at the with:with:with:with: syntax, I'm afraid
There is no easy way to recreate that syntax. If you really want it you'll have to go back to an old Croquet or Cobalt image.
But I very much doubt that anyone will really care. Since you're not going to make OpenGL calls all the time, you can't avoid introducing keyword syntax. As soon as you introduce keyword AND non-keyword syntax you're making it harder for new users (which I assume is your audience). They'll be confused when they can use keyword and when they can use non-keyword syntax, whether that will make any difference (Python 'named' arguments are optional) etc. They won't find that ever discussed in any book on Smalltalk they might look at, they won't understand if that is Smalltalk or some DSL and so on.
Simple consistency is best. Explain the mapping and trust in the smarts of people - as long as they understand the rules they'll be able to follow them.
Cheers, - Andreas
squeak-dev@lists.squeakfoundation.org