Multiple GLJPanels in one JFrame

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

Multiple GLJPanels in one JFrame

Ezekiel Kemboi
Hi. I'm currently developing one application, which should be able to run in stereomode. Due to my stereo setup - I need to draw same scene into two GLJPanels & apply some manipulation, which makes the stereoscopy work.

But I have a problem with placing two GLJPanels into one JFrame. They both share the same OpenGlListener. I also know, that when I put just one of these (either left or right) GLJPanel into that JFrame - everything works as I want to. But when I add two GLJPanels into JFrame (using FlowLayout), I instantly recieve javax.media.opengl.GLException: element vertex_buffer_object must be enabled to call this method.

I just want to ask - where could be the problem if I add two GLJPanels to one JFrame & get the VBO must be enabled exeption & when I put just one of these panels into JFrame - everyhing works as I want it to. I'm really lost in this...
Reply | Threaded
Open this post in threaded view
|

Re: Multiple GLJPanels in one JFrame

gouessej
Administrator
Hi

Use 2 instances of GLEventListener but use shared OpenGL contexts to make it work.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Multiple GLJPanels in one JFrame

Ezekiel Kemboi
Yeah,
I tried this too, but the result was the same. So I thought this is not the problem...Even when I used two GlEventListenrs - I had the same VBO problem...
Reply | Threaded
Open this post in threaded view
|

Re: Multiple GLJPanels in one JFrame

gouessej
Administrator
but you don't use shared contexts, do you?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Multiple GLJPanels in one JFrame

Ezekiel Kemboi
Nope. Should I? Never heard abouth them to be honest...
Reply | Threaded
Open this post in threaded view
|

Re: Multiple GLJPanels in one JFrame

gouessej
Administrator
Actually you would need to use shared contexts to share the data between 2 panels but you don't need 2 panels to use the stereo mode, this is not the right way of implementing it. You can use a single panel (you can put a plain GLCanvas into a JPanel instead of using GLJPanel) and draw you scene twice with different buffers (see glDrawBuffer, GL_BACK_RIGHT and GL_BACK_LEFT) and different model-view matrices. You can use the famous method called "parallel axis asymmetric frustum perspective projection". Good luck.
Julien Gouesse | Personal blog | Website