Binding textures without showing the GLCanvas

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

Binding textures without showing the GLCanvas

Firecow
Hey...

I was wondering if there is anyway to bind textures to GLContext without having to show the actual GLCanvas.

As of right now, i'm only able to bind my textures in the GLEventListeners init method.
But that is only called, when my GLCanvas is visible.

So i want to know if theres is a way, to bind the textures the GLContext ship that context to the GLCanvas and then set my GLCanvas visible?

Thanks in advance
  Mads

PS. Does the Jogl project have an IRC channel ?
Reply | Threaded
Open this post in threaded view
|

Re: Binding textures without showing the GLCanvas

Firecow
I found the answer my self.

You create a GLPBuffer and add a GLEventListener to it.

Run display() on you're pBuffer object, init and display will be called on your GLEventListener.
Initialize you're textures in the pBuffers context display or init doesn't matter.

Once that is done.

You create you're GLCanvas with the pBuffers context.

Looks something like this :D
GLCanvas canvas = new GLCanvas(caps, null, pBuffer.getContext(), null);

This lets your GLCanvas use the textures you've precreated in the pBuffer.
Reply | Threaded
Open this post in threaded view
|

Re: Binding textures without showing the GLCanvas

Michael Bien
On 07/12/2010 02:50 PM, Firecow [via jogamp] wrote:
> I found the answer my self.
>
> You create a GLPBuffer and add a GLEventListener to it.
...

> GLCanvas canvas = new GLCanvas(caps, null, pBuffer.getContext(), null);
> This lets your GLCanvas use the textures you've precreated in the pBuffer.
yeah, its context sharing + kind of offscreen rendering :)

good that it works for you. We should add this question to the FAQ... it
re-appears from time to time.

best regards,

michael