VBOs accross multiple GLCanvases

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

VBOs accross multiple GLCanvases

SouthernPotato
This post was updated on .
I have essentially just began to learn openGL, but I've worked with some watered down GL implementations before.

I have two GLCanvases that sit next to each other in a window, and they are attached to the same FPSAnimator. When I made a VBO, I found that java crashed when the second GLCanvas tried to render that VBO. I figured that the two GLCanvases have their own private memory allocation, so my solution for the moment is to map GLAutoDrawables to int arrays so that there are n VBOs for n GLAutoDrawables under one name. This way I can treat each GLAutoDrawable as if it has the same model and have it draw the VBO that it maps to. This solution mostly works, but in a big program I would hate to take up twice the memory, and also it's just a hassle.
Looking around, I see something about contexts but I cant get this to work. I've tried setting the context of one canvas to the context of the other, I've tried using setSharedAutoDrawable and this also doesn't seem to work (note that this is all done before the FPSAnimator is started). My reason for believing that this doesn't work is that my program always finds two distinct GLAutoDrawables.
The hope is that I only have to allocate VBOs once, as opposed to twice as I am now.

Thank you for any help you can provide.
Reply | Threaded
Open this post in threaded view
|

Re: VBOs accross multiple GLCanvases

gouessej
Administrator
Hi

Have you looked at our unit tests about shared contexts?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: VBOs accross multiple GLCanvases

SouthernPotato
I'm sure I'm missing something obvious, but could you point me to where I can find them? Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: VBOs accross multiple GLCanvases

gouessej
Administrator