Version française
Home     About     Download     Resources     Contact us    
Browse thread
Cross-platform "Hello, World" graphical application in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@j...>
Subject: Re: [Caml-list] Cross-platform "Hello, World" graphical application in OCaml
On Tuesday 22 February 2005 20:24, Richard Jones wrote:
> On Tue, Feb 22, 2005 at 07:24:28PM +0000, Jon Harrop wrote:
> > On Tuesday 22 February 2005 17:23, Richard Jones wrote:
> > > WxWindows isn't really suitable for what I want to do because it
> > > doesn't support a rich canvas widget, nor a good rich text editor.
> >
> > Does it support cross-platform OpenGL? If so then you could write your
> > GUI in OpenGL...
>
> Joke, right?

No, not at all.

Just this afternoon, a friend of mine suggested that I commercialise the OCaml 
port of my vector graphics engine:

  http://www.chem.pwf.cam.ac.uk/~jdh30/programming/opengl/smoke/

The OCaml implementation is much more evolved and vastly easier to use, of 
course. In particular, it makes cross-platform GUIs relatively trivial.

I didn't believe him though. I mean who would want to be able to write 
cross-platform GUIs easily? Especially smoothly animated ones with alpha 
blending, texture mapping and integrated 2D and 3D.

Seriously though, if I did this, would anyone be interested in buying it to 
develop commercial applications with for, say, 1,000UKP?

> Blender actually has a GUI written in OpenGL.  One of 
> the remarkable consequences of this is that you can smoothly zoom and
> sheer the controls ...

Yes, if you're already using OpenGL then there are a lot of advantages to 
having an OpenGL-based GUI. Even if you're not already using OpenGL, it is 
the most cross-platform GUI-capable API and runs on virtually any modern 
computer, typically with performance orders of magnitude better than anything 
you'll get with Qt, GTK, WxWindows or any other software renderer.

I develop for Linux and just had a go on another friend's Apple PowerBook. 
Once you've added <-cclib "-framework Foundation"> to the link line, the 
OCaml code compiles and runs beautifully.

If you want some examples of trivial OpenGL programs written in OCaml, have a 
look at the freebies from my book:

  http://www.ffconsultancy.com/products/ocaml_for_scientists/visualisation

There are Linux and Mac OS X executables you can just click on. Also, check 
out the examples which come with lablGL and lablglut.

The main omission for me is then the lack of native-looking drop-down menus 
and a save dialog. I tried to port my lablglut-based code to lablgtk but 
failed miserably - I couldn't even get a window with a menu bar and a 
full-size OpenGL widget.

Incidentally, would someone be so kind as to send me some Windows executables 
of my demos? Then we could have the full complement. :-)

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://ffconsultancy.com