Looking for tutorials on OpenGL simulations

I am looking at OpenGL as the output for simulations. I have done some reading and tutorials (in C/C++). There are some particular things that I am looking to do that the material covered so far hasn’t really dealt with. If someone can point me in the right direction, it is appreciated:

  1. Are there good resources/examples for having a different granularity of time for display vs. simulation? For example, I might simulate in 1ms steps, but display at 33ms steps (for 30FPS)?

  2. Are there good resources/examples for writing OpenGL output to a video file?

  3. Are there good resources/examples for both multi-threading and/or using several PC’s to process the simulation and/or the display output? In other words, simulation farms and render farms… I understand some higher-level modelling applications support render farms. I would like to do something similar, but at a lower-level (C/C++ OpenGL) as my simulations grow in complexity.

Thanks!

  1. When you create your opengl window, you are free to redisplay when you want like every 33ms. The way of doing it depend on how you setup this window: win32, glx, glut, …

  2. It is possible with OpenGL to get the color buffer back to system memory very efficiently. I advise you to look at PBO for the fatest way. However, opengl does not provide anything to encode video data. You may find out googling but IMO some people on the forum have already did this.

  1. it’s pretty simple really, you run each simulation assuming that each run represents 1ms.
    Then you have your main loop in where you run it multiple times depending on how much time has passed, then do the same thing for rendering.

  2. not really, the easiest way is possibly to output tga files that you can later assemble together.

  3. no not really, you need a server and client and that’s a hassle in itself, since the simulation has to be run linearly and that’s verry hard to do on a net connection.

You could look into stuff like cuda or openCL, it would allow you to run the simulation as fast as possible.