[self-interest] OpenGL

Jecel Assumpcao Jr jecel at merlintec.com
Thu Jun 12 00:04:33 UTC 2003


On Tuesday 10 June 2003 16:43, Josh Flowers wrote:
> How does self handle text?  I didn't see any glue code that dealt
> with text, and so I'd hoped that self was doing the text rendering. 
> If that's the case, then GL's text support shouldn't be a problem. 

The 'drawString:At:GC:' method calls platform specific code to do the 
real work.

> I'm not sure what kind of 2D texture support you need....

Imagine a red, metalic cylinder. With a white stripe near the bottom. 
And an orange circle in the middle wrapped half way around the 
cylinder.

> You're also correct that GL doesn't scale down to low end machines
> very well, but it should be usable on 90%+ of the desk/laptop
> machines out there, which would be a good start.

My problem is that is also doesn't scale up. When I get a machine that 
is 10 times faster than today's, it is going to look exactly the same. 
It might say it is doing 430 frames per second, but on a monitor with a 
70Hz refresh rate that is a lie. You won't notice this, of course, 
since by then we will have 10 times as many polygons on the screen in 
applications that don't run at all on today's machines. But today's 
applications won't be any better and that is my complaint.

Steve Dekorte wrote:
> The advantage is much, much faster rendering(2d, or 3d). Self is 
> painfully slow(dragging an outliner around involves waiting for it to 
> catch up with the mouse) on my dual 1.2Ghz Mac and I'm
> guessing(hoping) it's because of the rendering costs.

I got a 1/3 second delay on a 600MHz Pentium II and less than half that 
on a 277MHz UltraSparc II. On the latter it is only noticeable if you 
are testing for the effect.

> I suspect Self is like Squeak and handing off chunks of a screen
> buffer stored in RAM to the desktop rendering APIs. Since this
> involves heavy use of the CPU(which is poor piece of rendering hw) and
> pushing each bit across the bus, it's a very slow way to render.

No, the drawing routines in traits canvas are just a thin layer for the 
native (X or Carbon) graphics API. I think that the reasons for this 
are more historical (how the first GUI experiments were implemented) 
than practical (given the neat compiler technology), but I should 
probably let those who actually know comment on this. In any case, this 
greatly complicates porting compared to Squeak.

> Excellent antialiased text support isn't difficult to add using 
> freetype and a bit of code to cache the rendered characters into a  
> texture. Io does this, and I'm happy to share the code I use. The  
> performance is as good as (and probably better than) desktop font  
> renderers and the quality is much better than Self's current font  
> renderer(at least on OSX). Freetype also allows use of any TrueType  
> font, and there are some good free fonts out there.

Thanks for the tip. Looking at your code, I didn't see where the surface 
on which you are rendering the text is set. It has been such a long 
time since I looked at GL (it wasn't Open then ;-) so this looks 
strangely 2D to me...

BTW, I hope my comments don't make it seem like I am against linking 
Self and OpenGL. Quite the opposite! OpenGL is here now and this 
shouldn't be hard to do, so why not?

-- Jecel



More information about the Self-interest mailing list