PDA

View Full Version : Advanced image capturing



_BasY_
01-21-2009, 11:45 AM
Hi.

I'm working on molecular dynamics simulation, with more than 1 000 000 atom objects (C++, integrated with CUDA).
I have defined couple Camera objects (Position, Eye, Perspective, Near plane, Far plane, screen width and height)...
Calculation of 1 step of simulation takes time and after each step i need to capture images from all cameras...

Any ideas how to solve this problem?

I found an example of TGA image capturing, integrated with GLUT.
This works good but only for one camera (another camera can have different screen width/height, perspective... So i need one window for one camera (more glutCreateWindow calls) and i don't know how to solve stuff about static methods for glutDialsFunc and glutReshapeFunc on more windows)

Is it possible to do it this way:
1) Initialize one window

When TakeScreenShots() is called:
2) Draw atoms in the scene

3) Resize window to camera width/height
4) Setup perspective, near and far plane
5) Move camera to position and camera look
6) Take screenshot.
7) Go to 3 for each camera

Thanks for any ideas and help ...

satan
01-21-2009, 12:11 PM
Hi,

you have to render your scene multiple times to achieve what you want. Your step 2) is actually step 5a).
I don't see any reson why this should not work, but of course it will be slower than just rendering for one camera. But as I understand it is no real time application so it may be acceptable.
You may also want to take a look at FBOs and if they can help you speed up your application.

Nighthawk
01-23-2009, 02:55 AM
Like satan said, renderScene() after setting up the camera.
I'd try it this way:

1) Initialize one window

When TakeScreenShots() is called:
2) Remember window size
3) Resize window to MAXIMUM camera width/height

4) Setup perspective, near and far plane
5) Move camera to position and camera look
6) glClear, Draw atoms in the scene
7) Take screenshot.
8) Go to 4 for each camera

9) Restore window size