FLTK logo

RE: [fltk.general] Idle function for OpenGL scene?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

RE: Idle function for OpenGL scene? "MacArthur, Ian (Selex ES, UK)" Jan 14, 2014  
 
> I did it, but I am confuse on speed... 1/24 means
> 24 fps. But when I try to increase the frame per
> sec speed, I do not see any difference, I try 1/100
> fps, it just gives me a very minor effect.
> How can I increase the animation speed or fps?


I'm guessing you are on a WIN32 platform then? 

The stock WIN32 timers that fltk uses are heavily quantised (typically approx. 15 to 16ms in Win7, for example) so that means code producing animation using these timers tends to tick at quite distinct rates. 
Up to about 20 FPS it works pretty well, but if you ask for faster than that you tend to get either 30 FPS, 41 FPS or 62 FPS, and then nothing faster...

You can use Fl::add_idle() to implement an idle function, or use fltk's glut emulation layer (accessed via FL/glut.H, see docs...) to access a fltk-compatible implementations of glutIdleFunc() and other glut functions.


> In fact, I did pretty much work with glut functions
> in fltk. But the problem with glut is I can't create
> a c++ class with these function. These function doesn't
> provide this facility? Am I right?

Check the docs on using fltk's glut emulation layer in FL/glut.H as noted above.



> So, thats why, now I am moving to Fl_Gl_Window class.
> It is working well, the only and very important issue
> I am facing is, real-time Idle function speed.
> How can I increase the speed of real-time updating?

If you use the WIN32 timers it can be heavily quatised, as noted above. I have a test code I run, which on Linux and OSX scales the FPS pretty smoothly from 10 FPS to about 500 FPS.

The same code running on WIN32 scales up to about 62 FPS then will go no faster. 

If I replace the Fl::add_timeout() with an Fl::add_idle(), it then runs about 500 FPS or more, like the Linux and OSX versions...





Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.