SFML community forums

Help => General => Topic started by: fallout on December 09, 2012, 05:02:24 am

Title: Quad Buffering
Post by: fallout on December 09, 2012, 05:02:24 am
I'm new to stereoscopy so I hope I make some sense.

I want to implement side-by-side stereoscopy for a project. All I know so far is that I need to create an asymmetric frustum, something like this:

(http://ars.els-cdn.com/content/image/1-s2.0-S0141938212000534-gr4.jpg)

It seems like sf::View should be capable of doing this, but I'm not sure how. I think I should have 2 views that sample from one window?  One is a reference view (just integer coordinates) which points at the center of the window, and a left-eye and right-eye view that is offset in their respective directions from the center view. The problem with that is that it seems a window can only set one other view with setView(...). Or can it do more?

I've been told that for this to work, the api/framework/library that I'll be using - in this case, SFML - needs to support quad buffering (as well as the video card). That would be 2 buffers, front and back, for the left and right views. However, it seems that if I'm just taking samples from one renderwindow, I'll just have to make my draw calls and then display, which is basically quad buffering, is it not? If a window can't set two views at once, then how do you ensure that the left and right buffers for both sides swap at the same time?

edit: I just tested some code and a window cannot set more than one view. So, does SFML support quad buffering or do I have to use OpenGL?
Title: Re: Quad Buffering
Post by: Laurent on December 09, 2012, 08:56:59 am
SFML supports none of what you describe. The first thing being perspective projections: sfml-graphics (and sf::View) are purely 2D, and what you want to do requires 3D/perspective -- look at your picture, it's not the kind of perspective that sf::View provides.
Title: Re: Quad Buffering
Post by: Mario on December 12, 2012, 09:26:43 pm
You can fake the effect. I've done it in the past and it works rather well. Also you won't have to use any additional buffers or render textures (not the perfect solution, for better colors use a render texture):

For simple 2D games like platformers, this won't need perspective projection, however it might look odd if you try to move things back/forth without properly adjusting their scale.