[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dylan and OpenGL?



In article <3CC5EE90.6C686615@mac.com>, "D.G" <dogu@mac.com> wrote:

> I am looking for a new way of doing a project of mine, and dylan seems
> to be quite nice. I am writing an oo app for some physics simulation
> which uses openGL for real-time visualization. I have done it in cpp,
> with over 20k lines of code so far, but I am not satisfied with the
> outcome. And I am somehow stuck, as cpp doesn't allow me to do things I
> want, at least not the way I want to.

What are the limitations in C++ that are bugging you?


> Basically, I would like to know if it is performance wise possible to
> achieve cpp levels

Yes.

It can take some work, adding declarations and "sealing" to the critical 
parts of your program, but you can come to +/- the same speed as C++.

The good news is that you don't need to over-specify the *rest* of your 
program.

The main things that currently make Gwydion Dylan a little slower than 
C/C++:

- objects larger than 4 bytes are always allocated on the heap.  This 
can be a problem if you're allocating and deallocating in a tight loop 
and C++ is using stack-based objects.

- Dylan always checks array bounds.  Actual compilers have a way to 
escape this if you really need to, of course.

- Dylan's equivalent to virtual functions is more general and therefore 
slower.  However, the difference can usually be made small in cases you 
care about.


As an example of fast code from Dylan look at the ICFP Programming 
Contest (http://cristal.inria.fr/ICFP2001/prog-contest).


> and if there are no technical hindrances. I would
> like to make my program cross-platform, but am developing on OS 9 with
> CW 6 at the time. I am talking about putting about 100k-1000k triangles
> or more on the screen per second on current hardware. That is pretty
> much what my cpp code can do, even though it doesnt do much right now.

You're almost certainly being limited by OpenGL itself.

On OS 9 (and OS X) you're limited to the Open Source "Gwydion Dylan" 
(http://www.gwydiondylan.org).

Gwydion is primarily a Unix compiler and runs natively on OS X.  
However, Gabor Greif maintains a version implemented as a CodeWarrior 
plug-in compiler.

Gwydion Dylan comes with an OpenGL example.  I don't know if this works 
on OS 9.

  http://berlin.ccc.de/cgi-bin/cvsweb/gd/examples/gdgl

-- Bruce