How to enable quad-buffered stereo rendering

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to enable quad-buffered stereo rendering

michael.nischt
Hi there,

I have an 120Hz screen and the nvidia 3D vision kit plugged into my computer running Ubuntu (Linux-amd64) with a GeForce Quadro FX 4800 and want to use quad-buffered stereo rendering in jogl2. Unfortunately, I don't see how to enable it.

I set GLCapabilties.setStereo(true), but the flag is false in the chosen caps of the GLDrawable - a GLCanvas in my case. Actually, using a GLCapabiltiyChooser, none of the available modes has the stereo flag set to true. Accordringly a later query to glGetBooleanv(GL_STEREO, ..) returns GL_FALSE.

However, my system configuration is perfectly capable of it. For example these programs written in PyOpenGL work perfectly fine:
http://www.geeks3d.com/20090814/stereoscopic-camera-in-opengl-using-pyopengl/
I added the glGetBooleanv(GL_STEREO, ..) to these scripts and the returned value is GL_TRUE.

Can anyone help my enable stereo with JOGL2?

Thanks and Best,
 Michael


Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

Michael Bien
could you elaborate a bit on quad buffered stereo?

quadbuffer = plain old double buffer + stereo?

Sure we would like to support it somehow but the first step is to figure out whether stereo is something else as the quad buffered thingy.

in case stereo != quad buffered stereo
Does nvidia provide sample code in C? Context creation would be interesting for us. In best case its just a bug in the Capabilites choosing code and you would be served by just setting stereo to true.

regards,
michael


On 07/02/2010 04:52 PM, michael.nischt [via jogamp] wrote:
Hi there,

I have an 120Hz screen and the nvidia 3D vision kit plugged into my computer running Ubuntu (Linux-amd64) with a GeForce Quadro FX 4800 and want to use quad-buffered stereo rendering in jogl2. Unfortunately, I don't see how to enable it.

I set GLCapabilties.setStereo(true), but the flag is false in the chosen caps of the GLDrawable - a GLCanvas in my case. Actually, using a GLCapabiltiyChooser, none of the available modes has the stereo flag set to true. Accordringly a later query to glGetBooleanv(GL_STEREO, ..) returns GL_FALSE.

However, my system configuration is perfectly capable of it. For example these programs written in PyOpenGL work perfectly fine:
http://www.geeks3d.com/20090814/stereoscopic-camera-in-opengl-using-pyopengl/
I added the glGetBooleanv(GL_STEREO, ..) to these scripts and the returned value is GL_TRUE.

Can anyone help my enable stereo with JOGL2?

Thanks and Best,
 Michael





View message @ http://jogamp.762907.n3.nabble.com/How-to-enable-quad-buffered-stereo-rendering-tp938684p938684.html
To start a new topic under jogamp, email [hidden email]
To unsubscribe from jogamp, click here.


-- 
http://michael-bien.com/
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

michael.nischt
Michael, thanks for looking into this!

Yes, the quad-buffered technique is around since a decade or so. When enabled, you simple draw the scene twice: once with glDrawBuffer(GL_BACK_LEFT) and then with glDrawBuffer(GL_BACK_RIGHT). Unfortunately, the last call results in a GL_INVALID_OPERATION since there are no right buffers because glGetBooleanv(GL_STEREO, ..) returns GL_FALSE.

Setting Capabilites.setStereo(true) in the desired caps does not help. There reason is that the choosing is done by returning an index into the "available" array and all of the return false for getStereo(). Hence it is the same for "chosen" configuration.

I assume it is a simple bug in Jogl querying/setting the stereo capability bit since in works in python with glutInitDisplayMode (GLUT STEREO..).

Anyhow, I'll with try with the LWJGL tomorrow or on Tuesday and let you know if it works..

Best,
 Michael
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

michael.nischt
Just to confirm: quad-buffered rendering for stereoscopic 3D works well with the OpenGL Bindings of the LWJGL - even embedded inside awt using the AWTGLCanvas. So it has to be a Jogl/Jogamp specific bug.

A fix would be very much appreciated, but I'm glad that I can continue to use Java with the LWJGL in the meantime (and possible in the future as I like LWJGL's simplistic approach).

Best,
 Michael
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

Sven Gothel
Administrator
In reply to this post by michael.nischt
On Sunday, July 04, 2010 21:22:04 michael.nischt [via jogamp] wrote:

>
> Michael, thanks for looking into this!
>
> Yes, the quad-buffered technique is around since a decade or so. When
> enabled, you simple draw the scene twice: once with
> glDrawBuffer(GL_BACK_LEFT) and then with glDrawBuffer(GL_BACK_RIGHT).
> Unfortunately, the last call results in a GL_INVALID_OPERATION since there
> are no right buffers because glGetBooleanv(GL_STEREO, ..) returns GL_FALSE.
>
> Setting Capabilites.setStereo(true) in the desired caps does not help. There
> reason is that the choosing is done by returning an index into the
> "available" array and all of the return false for getStereo(). Hence it is
> the same for "chosen" configuration.

Yep, our colleague Rami is aware of this too,
and a fix will be provided.

Thank you for the good description.

If you have time (and still a bit patience with JOGL),
you may like to provide a test case to reduce some overhead
and misunderstandings here.

>
> I assume it is a simple bug in Jogl querying/setting the stereo capability
> bit since in works in python with glutInitDisplayMode (GLUT STEREO..).
>
> Anyhow, I'll with try with the LWJGL tomorrow or on Tuesday and let you know
> if it works..
>
> Best,
>  Michael

Cheers, Sven
Reply | Threaded
Open this post in threaded view
|

RE: How to enable quad-buffered stereo rendering

Rami Santina
Administrator

Yup this is from a while ago when I was testing stereo with our application…

 

First of all can you paste the capabilities available (log file or just print the capabilities) and some info regarding graphic driver & model

 

PS: some new drivers from Nvidia come without quad buffer support (depending on card family) so check if you have quad buffered support.

 

Anyways for me to get it to work, I had to manually select the capabilities that include stereo. Since you might request some conflicting desired caps that doesn’t come when utilizing stereo.

Will have to check again if this is still valid…but anyways try it.

 

 

 

Override the choose capability function in DefaultCapabilitiesChooser

 

DefaultGLCapabilitiesChooser choiceExaminer = new DefaultGLCapabilitiesChooser()    {

                                                public int chooseCapabilities(GLCapabilities desired, GLCapabilities[] available, int windowSystemRecommendedChoice)

                                                {

                                                                int sysChosenCapIndex = super.chooseCapabilities(desired, available,windowSystemRecommendedChoice);                                             

 

int desiredCapIndex = …. Chose the one with stereo mode from the available caps.

 

return desiredCapIndex;

                                                }

};

….

 

GLCapabilities stereoCaps = new GLCapabilities();

stereoCaps.setStereo(true);

                               

                GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

                               

                glcanvas = new GLCanvas(stereoCaps, choiceExaminer, null, device);

 

….

 

IF all you available caps are false for stereo, then the log/model/driver info would be helpful.

 

Hope it helps!

 

 

 

From: Sven Gothel [via jogamp] [mailto:[hidden email]]
Sent: Tuesday, July 06, 2010 4:39 PM
To: Rami Santina
Subject: Re: How to enable quad-buffered stereo rendering

 

On Sunday, July 04, 2010 21:22:04 michael.nischt [via jogamp] wrote:


>
> Michael, thanks for looking into this!
>
> Yes, the quad-buffered technique is around since a decade or so. When
> enabled, you simple draw the scene twice: once with
> glDrawBuffer(GL_BACK_LEFT) and then with glDrawBuffer(GL_BACK_RIGHT).
> Unfortunately, the last call results in a GL_INVALID_OPERATION since there
> are no right buffers because glGetBooleanv(GL_STEREO, ..) returns GL_FALSE.
>
> Setting Capabilites.setStereo(true) in the desired caps does not help. There
> reason is that the choosing is done by returning an index into the
> "available" array and all of the return false for getStereo(). Hence it is
> the same for "chosen" configuration.


Yep, our colleague Rami is aware of this too,
and a fix will be provided.

Thank you for the good description.

If you have time (and still a bit patience with JOGL),
you may like to provide a test case to reduce some overhead
and misunderstandings here.

>
> I assume it is a simple bug in Jogl querying/setting the stereo capability
> bit since in works in python with glutInitDisplayMode (GLUT STEREO..).
>
> Anyhow, I'll with try with the LWJGL tomorrow or on Tuesday and let you know
> if it works..
>
> Best,
>  Michael

Cheers, Sven


View message @ http://jogamp.762907.n3.nabble.com/How-to-enable-quad-buffered-stereo-rendering-tp938684p946403.html
To start a new topic under jogamp, email [hidden email]
To unsubscribe from jogamp, click here.

 

Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

Justin
In reply to this post by michael.nischt
I work with a similar setup, except we have a Quadro FX 1800 which is not supported by Linux yet. I'm stuck with Windows for now, but I'm familiar with quad-buffered stereo in JOGL applications. Maybe I missed it or doing it a way I haven't tried, but when you say you set GLCapabilities.setStereo(true), you're adding that GLCapabilities object to the GLCanvas' constructor right? Also, I believe in Linux you must set a "stereo" flag in the xorg.conf file. Anyway, I can provide some code that works under Windows to help narrow down your problem:

--------------------------------------------------

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import com.jogamp.opengl.util.FPSAnimator;
import com.jogamp.opengl.util.gl2.GLUT;

public class StereoTest implements GLEventListener {

        private GLU glu = new GLU();
        private GLUT glut = new GLUT();
       
        public static void main(String[] args) {
                StereoTest stereoTest = new StereoTest();
               
                GLCapabilities glCaps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
                glCaps.setStereo(true);
                GLCanvas canvas = new GLCanvas(glCaps);
                canvas.addGLEventListener(stereoTest);

                final Frame frame = new Frame("Stereo Test");
                frame.add(canvas);
                frame.setSize(800, 600);
                frame.setLocationRelativeTo(null);
                final FPSAnimator animator = new FPSAnimator(canvas, 60);
                frame.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent e) {
                                animator.stop();
                                frame.dispose();
                                System.exit(0);
                        }
                });
                frame.setVisible(true);

                animator.start();
                canvas.requestFocusInWindow();
        }
       
        public void init(GLAutoDrawable drawable) {
                GL2 gl = drawable.getGL().getGL2();
               
                gl.glMatrixMode(GL2.GL_PROJECTION);
                gl.glLoadIdentity();
                glu.gluPerspective(45.0f, 800/600.0f, 1, 100);
               
                gl.glMatrixMode(GL2.GL_MODELVIEW);
                gl.glLoadIdentity();
                glu.gluLookAt(0, 0, 4, 0, 0, 0, 0, 1, 0);
               
                gl.glEnable(GL.GL_DEPTH_TEST);
                gl.glEnable(GL2.GL_LIGHTING);
                gl.glEnable(GL2.GL_LIGHT0);
        }

        public void display(GLAutoDrawable drawable) {
                GL2 gl = drawable.getGL().getGL2();
               
                gl.glDrawBuffer(GL2GL3.GL_BACK_LEFT);
                gl.glClear(GL.GL_COLOR_BUFFER_BIT |GL.GL_DEPTH_BUFFER_BIT);
                gl.glPushMatrix();
                gl.glTranslated(-0.2, 0, 0);
                drawScene(gl);
                gl.glPopMatrix();
               
                gl.glDrawBuffer(GL2GL3.GL_BACK_RIGHT);
                gl.glClear(GL.GL_COLOR_BUFFER_BIT |GL.GL_DEPTH_BUFFER_BIT);
                gl.glPushMatrix();
                gl.glTranslated(0.2, 0, 0);
                drawScene(gl);
                gl.glPopMatrix();
        }
       
        private void drawScene(GL2 gl) {
                glut.glutSolidTeapot(1);
        }

        public void dispose(GLAutoDrawable drawable) {}

        public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {}
}
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

Rami Santina
Administrator
Did some checking on the QuadFx 1800 and found that there might be a problem when using this card or the 580 with quad buffered since its of an older version.

If in your case the right image is showing only, test this by.. rendering two objects one with different  colors on each eye.

Accourding to Nvidia you will need to update your VBIOS,

http://forums.nvidia.com/index.php?showtopic=107594
http://www.nvidia.com/object/quadro_stereo_technology.html

after that check the settings and choose Quad Buffering..and you should be fine. GPU-Z software could be useful in this case to check your VBIOS version.

To make sure it all works check the Test application provided by Nvidia.

Hope it helps.
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

Mathieu Blossier
Hi,

I know this post a quite old - is there somewhere some info about which NVidia Quadro models work, and on which os ?

I would like to change my gpu to do stereo with jogl2.

Thanks a lot,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

gouessej
Administrator
In my humble opinion, "customer" graphics cards have more reliable drivers, I don't advise you to buy a Quadro. The stereo is available on a lot of graphics cards, it shouldn't be a criteria of choice.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

Mathieu Blossier
Hi,

Thanks for your quick reply. Could you please advise me some gpu that you know is working in stereo with jogl2 ?

Cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

gouessej
Administrator
I used a Quadro FX under Fedora in my previous job, I'll try to get the exact reference soon.

If you only use glDrawBuffer with GL_BACK_RIGHT and GL_BACK_LEFT, it should work with any graphics card compatible with at least OpenGL 1.1 (it was already doable in 1999...). All graphics cards sold nowadays support that but I understand that you want to be absolutely sure that it works, that's why I will give you at least one reference of a graphics card that supports it for sure without trouble.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

gouessej
Administrator
In reply to this post by Mathieu Blossier
The Nvidia Quadro 2000, the Nvidia Geforce Go 6200 and the Nvidia Quadro NVS 285 should work very well.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to enable quad-buffered stereo rendering

Mathieu Blossier
Hi,

Thanks for this detailed answer !

Does that mean also that I would be able to connect e.g. a 3D monitor to one of this card and make the stereo working ? (I suppose this depends on drivers)

Cheers,
Mathieu