On 07.01.2008, at 18:07, Jens Grunert wrote:

> thanks for the tips, I did a quick modification doing the redrawing  
> of all rectangle within one container in the draw() function but  
> it's even slower.
>
> I did also play with the return values from the handler in the  
> original program but could not notice any differenze.
>
> Are there any other ways to make it faster (I can't use opengl since  
> the graphic card does  not support it).


Why are you calling Fl::wait(1) from within zoomincb? This is bad in  
many respects:

1: Fl::wait(1) wait for a *maximum* of 1 second, but likely much  
shorter if it gets interrupted by an event, so it doesn't do you any  
good here

2: *if* a certain event occurs during Fl::wait(), your callback will  
be called recursivey, generating a huge stack of local variables.

All this explains why your app spends 20% inside the handle() function.


But on a more general note, it is simply not useful to generate 1  
million widgets. That would be like rendering a forest, starting at  
the tree furthes away from the camera in full quality. I suggest you  
find out how you can reduce the number of widgets in your app to  
something a regular PC can handle, or alternatively ealuate mouse  
events using only one big widget and some programming smarts. As for  
rendering complex graphics, you either can do some smart buffering and  
incremental drawing, texture mapping or similar, or go with an API  
that is made for drawing large amounts of objects, like OpenGL (and if  
OpenGL is not an option, fall back to the first).

It would probably be easier if you could describe what you are  
planning to do with millions of widgets, so we can help you to find an  
alternative approach.


Matthias



----
http://robowerk.com/


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to