haolei
Newcomer
Currently, we are using Ge-force FX 5900 video card (from eVGA.com) and DirectX to create a stereo 3D-space environment with the head mounted display devices.
In order to emulate the specific eye disease (for example, glaucoma) and using normal eyes subject to do research, we need modify the 2D scene after 3D rendering and projecting to 2D near plane based on the specific view pattern. We can not simply block part of scene. If this were a way, all would be simple.
What we do is that using our collaborators' 2D algorithm (http://www.svi.cps.utexas.edu/examples.htm) to filter this 2D projected image based on specific eye disease pattern before the scene is present on the screen. This requires us to read the 2D projection image out from the video buffer, filter it, then feed back to the video buffer to display it.
My questions are:
1. how to read out the video buffer by directX in VC++ ?
2. how to write back to the video buffer by directX in VC++?
3. how to using multi-video-buffer and control video card to show
the filtered image rather than directly image from the projection?
Someone gave the answer as follows:
------------------------------------------------------------------------------
The IDirect3dDevice9 interface has two methods: GetFrontBufferData() and GetBackBuffer(). Both methods allow you to read frame buffer data that was previously rendered to your device. The methods basically return a pointer to the pixel data.
You should NOT use these methods for what you are trying to achieve because both methods will have a major impact on your performance. Your simulation will not run interactively if you take this approach.
The better way:
1. create a separate IDirect3DSurface9,
2. attach it to the IDirect3DDevice9,
3. render the scene,
4. detach the surface and do a LockRect() on it which will return a pointer to the image data.
5. While all this is going on the graphics card can be used for other things
6. (example rendering and displaying the next frame).
---- end of answer -------------------------------------
So far, I could not figure out how to do it.
Could anyone give me the sample code to demo how to do these?
Thanks,
Haolei
In order to emulate the specific eye disease (for example, glaucoma) and using normal eyes subject to do research, we need modify the 2D scene after 3D rendering and projecting to 2D near plane based on the specific view pattern. We can not simply block part of scene. If this were a way, all would be simple.
What we do is that using our collaborators' 2D algorithm (http://www.svi.cps.utexas.edu/examples.htm) to filter this 2D projected image based on specific eye disease pattern before the scene is present on the screen. This requires us to read the 2D projection image out from the video buffer, filter it, then feed back to the video buffer to display it.
My questions are:
1. how to read out the video buffer by directX in VC++ ?
2. how to write back to the video buffer by directX in VC++?
3. how to using multi-video-buffer and control video card to show
the filtered image rather than directly image from the projection?
Someone gave the answer as follows:
------------------------------------------------------------------------------
The IDirect3dDevice9 interface has two methods: GetFrontBufferData() and GetBackBuffer(). Both methods allow you to read frame buffer data that was previously rendered to your device. The methods basically return a pointer to the pixel data.
You should NOT use these methods for what you are trying to achieve because both methods will have a major impact on your performance. Your simulation will not run interactively if you take this approach.
The better way:
1. create a separate IDirect3DSurface9,
2. attach it to the IDirect3DDevice9,
3. render the scene,
4. detach the surface and do a LockRect() on it which will return a pointer to the image data.
5. While all this is going on the graphics card can be used for other things
6. (example rendering and displaying the next frame).
---- end of answer -------------------------------------
So far, I could not figure out how to do it.
Could anyone give me the sample code to demo how to do these?
Thanks,
Haolei