On 4/24/06, Robert Feldt <robert.feldt / gmail.com> wrote:> Ilmari,>> On a related note: Since you have been into Ruby and OpenGL stuff> before (librend, right?) what are your thoughts on the main> event/drawing loop? Inertia currently takes quite a large percentage> of my CPU time (I could get down to about 15% without noticeable lag> in the UI); I guess Mike has not been considering optimizations much> at this stage. If you do things in OpenGL will it update only the> portions that need updating or what are some different strategies for> optimizing the drawing? Care to enlighten us? But maybe in librend> it's not a problem cause you use all the cpu time you can get for> better frame rates? ;) ;)
OpenGL redraws everything all of the time,much like a ninja flipping out.The good thing about that is that OpenGL is fast enough to do that.The bad thing is that Ruby becomes the limiting factor(at least in librend.)
Optimizing drawing 2D elements is pretty much:draw costly stuff into texture, use massive fillrate for compositing.So you'd draw the glyphs of a font into a texture  then draw ~2000triangles with correct texture coordinates to create a 1000 letterparagraph of text.) Current graphics cards can push around 100times more texels than triangles per second, so this makes some sense.
Optimizing the CPU part is, roughly:* do as few method (and proc) calls as possible* create as few new objects as possible (Floats included)* have as few individual objects in the scene as possible* update the display only when something has changed* limit the framerate to 60* don't write your own 3D engine but use Ogre3D or something ;-)

> On the widgets-are-much-work question: Also remember that much code is> already out there and we can base things on that. Squeak, other widget> kits etc. For an editor there are also several pure-Ruby offerings out> there that can be used (Simon had AEditor, there is a ruby-vim/ruvim)> etc.
Yeah, granted. Working from existing code would make reimplementing gomuch faster.

Ilmari