Browse thread
Example slowing down... (OpenGL/lablgl)
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Oliver Bandel <oliver@f...> |
| Subject: | Example slowing down... (OpenGL/lablgl) |
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