caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Example slowing down... (OpenGL/lablgl)
@ 2007-04-11 22:25 Oliver Bandel
  2007-04-12  0:07 ` [Caml-list] " skaller
  2007-04-12  7:15 ` Jon Harrop
  0 siblings, 2 replies; 12+ messages in thread
From: Oliver Bandel @ 2007-04-11 22:25 UTC (permalink / raw)
  To: caml-list

Hello,

today I tried lablgl the first time succesful. :)

It's nice.

I tried the example from

  http://en.wikipedia.org/wiki/OCaml

=================================================================
 let _ =
    ignore( Glut.init Sys.argv );
    Glut.initDisplayMode ~double_buffer:true ();
    ignore (Glut.createWindow ~title:"OpenGL Demo");
    let render () =
      GlClear.clear [ `color ];
      GlMat.rotate ~angle:(Sys.time() *. 0.01) ~z:1. ();
      GlDraw.begins `triangles;
      List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.];
      GlDraw.ends ();
      Glut.swapBuffers () in
    Glut.displayFunc ~cb:render;
    Glut.idleFunc ~cb:(Some Glut.postRedisplay);
    Glut.mainLoop ()
=================================================================

That's nice, only 14 lines of code and the example is done. :)

But after I made the window with the triangle greater,
this examplke slowed down extremely! :(

It seems that it does not use the features of the
graphics card for some reasons. (??!)

I have a gentoo-linux and an nvidia graphics card in the
PC. Running on AMD-64 architecture.

The first days I didn't used the closed-source nvidia drivers and tried
an old C-source I had written. It was a threded application;
in one of the thredas I had temporarily inserted one of the OpenGL-examples
from the RedBook. This was intended as aa placeholder for some time,
until I would write my own OpenGL-stuff for that thread.

In a small window that RedBook-example was amazingly fast.
And it slowed down, when making the window bigger, but nevertheless
was fast enough. When using "fog" effects, it slowed down extremely.

Later I used the nvidia-driver and it was so amazingly much more faster
than before, and slowing down, when making the window greater, was
not such a big effect. Using fog nearly had no effect.

The sources of the RedBook-example are written in C.


And today I tried OCaml with lablgl and this simple
triangle.
In a small window it was circling very fast, but making the window
bigger slowed down the circular velocity a lot!

What's going on here?
Is the lablgl-binding - for some reason - NOT
using features that are using accelerated graphic-card's
features? Is the binding relaying on non-accelerated
functions?

Or is the OCaml-code in the above example
written in bad OpenGl-style?
(But I see the keyword double-buffering in the example,
 so it should be fast (?!))

Or is OCaml itself slowing down for some reasons?

As I didn't have changed the X11-settings (using X11-Xorg-Server)
the same (accellerated) driver is running as it was as I tried the
RedBook-examples.

So there must be something with the above code or the lablgl-Lib
or with OCaml that makes the application slowing down, when the
window is enlarged.


Someone who knows, what the problem is?!

Thanks In Advance,
      Oliver Bandel


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-04-13  1:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-11 22:25 Example slowing down... (OpenGL/lablgl) Oliver Bandel
2007-04-12  0:07 ` [Caml-list] " skaller
2007-04-12 14:09   ` Oliver Bandel
2007-04-12  7:15 ` Jon Harrop
2007-04-12 14:33   ` Oliver Bandel
2007-04-12 19:46     ` Jon Harrop
2007-04-12 20:26       ` Martin Jambon
2007-04-12 22:19         ` Jon Harrop
2007-04-13  0:30           ` Martin Jambon
2007-04-13  0:44             ` Jon Harrop
2007-04-12 20:47       ` Oliver Bandel
2007-04-13  1:12       ` skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).