English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

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: 2005-02-23 (03:56)
From: Jon Harrop <jon@j...>
Subject: Re: [Caml-list] Cross-platform "Hello, World" graphical application in OCaml

This is getting off topic so I'll keep it brief...

On Wednesday 23 February 2005 03:13, Daniel Bünzli wrote:
> a) An OpenGL context is not a lightweight structure. Especially if you
> are doing realtime rendering, a context switch is a heavy operation.

I've never had a performance problem with context switching. As a test, try 
running multiple copies of my OpenGL demos:


> Very often it is much more efficent to have a single context in which
> you draw various subregion by setting the viewport and scissor rect
> rather than creating many opengl contexts.

If you want multiple windows you can't do this, of course.

> b) OpenGL context management is not defined in the opengl specification
> but by platform specific libraries (e.g. agl, wgl, glx, etc) that
> behave quite differently and this means that you may run into various
> issues (like platform dependent context texture sharing policy).

Whatever library created the contexts for you tends to handle all that, e.g. 
FLTK and Qt do. This isn't rocket science though. OpenGL users have to do 
this themselves if they want to use pbuffers, for example:


> Sure but if they do then :
> 1) Either they don't work at the level of OpenGL. That is they use the
> platform specific gui libraries to provide their cross-platform
> abstraction. Then we are not talking about the same thing (I was
> talking about opengl-based gui systems).

I see, you were referring to toolkits which render native-like GUIs using 
OpenGL. Sorry, I was talking about actually calling real native GUIs from an 
OpenGL app.

> 2) Or they try to mimic the platform-specific look in their rendering,
> an imitation that can become obsolated by any system update.

Yes. GLUI mimics Windows 9x using OpenGL, for example.

> But looking at the end of your message I think that we may not be
> talking about the same thing.

Yes, I think we were talking at cross purposes.

To recap, if you must have some native-looking windows in an OpenGL app, you 
should be able to implement it quite easily (in theory). In practice, I have 
been unable to do this from OCaml, so I'd be very interested if anyone has a 
demo of this working. :-)

I'd suggest sticking to lablglut and writing your own GUI entirely using 
OpenGL though, as I have found this to be much more stable. I don't really 
think users will be too bothered by a slightly-different-looking GUI though, 
especially if it looks better. :-)

Dr Jon D Harrop, Flying Frog Consultancy Ltd.