I have written a Win32 C++ program.
I would like to duplicate the visual content of the left window every frame, so it appears at another location on the screen. (One rectangle on the left side of the screen, and an identical rectangle on the right side of the screen.)
This is for stereo rendering, where the left rectangle is seen in the user's left eye, and the right rectangle in the right eye.
The two rectangles must be "frame synced", meaning that they must show the same frame at all times. Or to put it another way, if the right eye is behind the left by "one draw call", then the viewer becomes ill.
NOTE: I have the source code to both windows, because I created them. (Both windows reside within the same exe at the moment.)
What I have tried:
- BitBlt(), by drawing a rectangular portion of the desktop HDC into the right-side window. I am calling BitBlt() in the WM_PAINT message of the right-side window: This works, BUT the right-side window is 1-2 frames behind the left.
Potential Solutions:
In the left-window's WM_PAINT message, draw both windows with the same contents. Is this possible somehow?
Use one, single giant window to draw both rectangles. This would mean all drawing occurs in the same WM_PAINT call. However, I do not know how to copy part of a window to another part. I wish I could just tell Win32 to 'draw again', but this time start 1000 pixels to the right...
Do "something" with DirectX. (No idea what.)
Any help would be greatly appreciated!