It is currently Thu May 23, 2013 2:51 pm



Reply to topic  [ 7 posts ] 
 Developing an OpenGL interlaced stereo 3D driver 
Author Message
One Eyed Hopeful

Joined: Sat Feb 12, 2011 6:18 pm
Posts: 3
I've had a bit of success adding interlaced stereo 3D support to my own OpenGL programs using this (somewhat crude) technique:
  • Clear the scene
  • Use the Z buffer to mask out the odd scan lines
  • Draw the scene from the left eye perspective
  • Use the Z buffer to mask out the even scan lines
  • Draw the scene from the right eye perspective
  • Show the scene

It has some obvious limitations (e.g. falls over if the program switches off Z testing) but so far the results have been promising. It's also easy to switch to anaglyph stereo by using glColorMask to mask out the colour channels instead of masking out scan lines. And it doesn't require any special buffers.

I reckon I could bundle it into a driver if I could intercept a handful of OpenGL functions. But I'm not sure how to do this.
Googling has lead me to "IAT patching" but most of the information is old and I don't want to use a hacky technique that antivirus or Windows UAC would block.

Is there a "right" way to go about this?

Image
Anaglyph Interlaced


Sat Feb 12, 2011 6:47 pm
Profile
3D Angel Eyes (Moderator)
User avatar

Joined: Sat Apr 12, 2008 8:18 pm
Posts: 10038
Sounds cool bro. Don't know much about OpenGL myself, but I wish you the best of luck. Did you model that brain creature?

_________________
Image


Sun Feb 13, 2011 12:43 am
Profile
One Eyed Hopeful

Joined: Sat Feb 12, 2011 6:18 pm
Posts: 3
cybereality wrote:
Did you model that brain creature?

Nope :). It's from an OpenGL port of the Doom II source code that replaced the flat sprite objects with MD2 models. I don't know who modelled it but it's one of my favourites.


Sun Feb 13, 2011 2:00 am
Profile
Golden Eyed Wiseman! (or woman!)
User avatar

Joined: Sat Jan 09, 2010 2:06 pm
Posts: 1897
Location: Perpignan, France
It's quite easy to write an OpenGL interposer thanks to the "preload" feature of Linux/Unix systems, but it seems to be a little bit more difficult to do it correctly under Win32. Have a look at this paper titled "Intercepting OpenGL calls for rendering on 3D display" to get you started :
http://liu.diva-portal.org/smash/record ... iva2:21335


Sun Feb 13, 2011 7:35 am
Profile WWW
One Eyed Hopeful

Joined: Sat Feb 12, 2011 6:18 pm
Posts: 3
Thanks for that. I feel I have some idea of what the different approaches are now.

I'm sticking with IAT patching for the moment. Although it doesn't work with a lot of programs when it does, the results are encouraging.
Image
FlightGear

I may try the function detour/trampolining approach too.


Thu Feb 17, 2011 5:02 am
Profile
Golden Eyed Wiseman! (or woman!)
User avatar

Joined: Sat Jan 09, 2010 2:06 pm
Posts: 1897
Location: Perpignan, France
You can also use a texture instead of the Z-buffer to mask the odd or even scanlines, that way you won't be dependant on the use of the Z-buffer. NVIDIA has also published several papers where they explain how they did implement their stereo driver, you can find useful informations there :
http://developer.download.nvidia.com/pr ... nd_Out.pdf
http://http.download.nvidia.com/develop ... Stereo.pdf
http://www.nvidia.com/content/GTC-2010/ ... TC2010.pdf

I also did implement a stereo 3D driver prototype for OpenGL under Linux some time ago, it did only work for anaglyphs but you may find interesting informations inside. You can find the code here :
http://frederic.lopez.free.fr/linux/glstereo-0.1.tar.gz


Thu Feb 17, 2011 6:14 am
Profile WWW
Two Eyed Hopeful

Joined: Tue Dec 22, 2009 11:48 am
Posts: 79
tmulgrew> Any news ? Did you manage to do something working ?

I'm interested in your work because I want to continue Fredz' work on glstereo (for Linux) :P

If you have some problems or, if you have some codes to share, don't hesitate ;)

Thanks


Wed Mar 02, 2011 4:05 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.