OpenGl_Player (plays GL code sequences like a video)

User projects written in or related to FreeBASIC.
Post Reply
Posts: 3766
Joined: Dec 06, 2009 22:27
Location: N47°, E15°

OpenGl_Player (plays GL code sequences like a video)

Post by TJF »

OpenGl_Player is a GTK app for win32 and LINUX. It works like a media player. But instead of playing music or video files it plays OpenGl sequences provided as modules (or plugins).

OpenGl-Player loads at start-up all modules from the 'modules' folder and shows them in a ListView. The user chooses one modul from the list to watch. It can get startet, stopped, restarted or reseted to the beginning. By changing the selection in the ListView different modules can be played and compared.

A modul is a FreeBasic program compiled as a dynamic library with command 'fbc -dylib ...'. A new compiled modul can be loaded by OpenGl_Player at run-time (refresh). It's also possible to search for new modules at run-time (rescan).

A main target of OpenGl_Player is to test OpenGl sequences, ie to optimize lightning or material parameters. The sequence of question gets coded as small modul. Compiling of the short code is fast and the result can get tested immediately. While OpenGl_Player offers all features to watch the sequence, the source code of the modul is reduced to the minimum.

A modul can load some data from HDD, ie to show the result of a former simulation. Or the simulation data gets calculated while the modul is running as in the ODE_... examples. The modul can have a GUI window as well, ie to show results in a line or bar grafic or to set some parameters.

The package contains source only:
  • src/OpenGl_Player.bas (the source to compile)
  • src/ (header to include in all modules)
  • src/OpenGl_Player.ui (GUI-XML file)
  • src/tobac/*.bas (source code for signal handlers)
  • src/modules/empty.bas (an empty modul source code frame)
  • src/modules/Teapot.bas (modul source code for a dancing teapot)
  • src/modules/ODE_Boxes.bas (modul source code for simulating a falling box stack)
  • src/modules/ODE_Bouncing.bas (modul source code for simulating two balls falling on a box)
  • src/modules/ODE_Dominoes.bas (modul source code for simulating falling dominoes)
  • src/modules/*_tobac.bas (source code to bind GUI-XML files)
  • src/modules/*.ui (GUI-XML files)
Technical details:

OpenGl_Player tries to show the simulation in realtime at a framerate of 50 fps. A g_timeout function is used to calculate the next step and afterwards the OpenGl drawing area gets refreshed. If the last refresh isn't finished the next refresh gets skiped (and maybe more frames). But if the calculation of a step needs more time than 20 ms (50 fps) the simulation slows down.

A modul can change the default frame rate (and should restore it when done).

You'll need a GTK installation >= 2.16 (due to GtkBuilder).

Download: ... -225.html#

Some screenshots:

Post Reply