Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hey all,
I have an application with four drawing contexts. as of jogl 2.2 I am using createDummyAutoDrawable() to mke the context working with the same textures. Now I have a major problem. 1. I create a context 1 with a Shader that creates a textures through FBO. That works great. 2. This texture is beeing drawed in context 1. 3. Now the user enables context 2. The texture is also used for drawing in context 2. 4. The context 1 is beeing destroyed since it is not displayable anymore (user hides the context in the application). In this case the context for the Shader is not valid anymore and I get weird problems. (5. worst case would be that non of my contexts are shown anymore and I still expect the Shader is running) My question is. What is the best practice for this? Is there some kind of offscreen context that I could use for? I already tried to used the sharedDrawable from createDummyAutoDrawable, but this is not valid for drawing and Shader. I had an idea of creating an offscreen 1x1 pixel context that holds all these objects and shaders for the life time of my application. Actually, I don't like the idea since there is a blinking pixel somewhere in the screen. I hope there is a better solution for this. kind regards Matthias |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Hi
There are several ways of preserving the context and it depends on the toolkit you use. Do you use NEWT, a GLStateKeeper or a shared context?
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hey Julien,
thanks for your fast reply :) Well, currently I am using a shared context right now. Created like this: glp = GLProfile.get(GLProfile.GL2); caps = new GLCapabilities(glp); sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, true, caps, null); The main problem is that my GLCanvas'es are beeing destroyed though JPanel.remove. They might exist but they should not. That means I really would like to draw even if the canvas'es are not shown. Any idea? Matthias |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
I fear it is the expected behavior when using AWT (but not with NEWT). When the GLCanvas is removed from its container, it calls removeNotify and the context gets destroyed. Have you tried to use setSharedAutoDrawable()?
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Okay, I see. It is okay that all canvases are beeing destroyed as long as I can have an invisible canvas somewhere where my shaders can still render. How about GLDrawableFactory.createOffscreenDrawable ? Can this render somehow with a valid GL context?
(I am using setSharedAutoDrawable for all my contextes) |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Yes, there are some examples using it in our unit tests. Sven and neothemachine have a lot more experience than me with offscreen rendering, I would appreciate that they give you some insights...
Personally, I use an offscreen drawable to draw some meshes just to build image previews but I don't know why one of the methods called createOffscreenAutoDrawable has become deprecated :s Edit.: The one accepting a shared context was deprecated several months ago, probably because it's better to use a setter to pass this object.
Julien Gouesse | Personal blog | Website
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by slajar
On 06/17/2014 11:31 AM, slajar [via jogamp] wrote:
> Okay, I see. It is okay that all canvases are beeing destroyed as long as I > can have an invisible canvas somewhere where my shaders can still render. How > about GLDrawableFactory.createOffscreenDrawable ? Can this render somehow with > a valid GL context? > yes. also looks at shared unit tests, i.e. find jogl/src/test -name \*Shared\* You probably like to have an offscreen GLAD .. however, they all work. > (I am using setSharedAutoDrawable for all my contextes) err .. GLSharedContextSetter.setSharedAutoDrawable(..) , yes .. exists to sync shared context creation w/ GLAD. ~Sven |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by gouessej
thanks all for yor answers. I implemented it a bit more differently. I created a fith canvas thta is just 1x1 pixels and resides in the upper left coner. That does the trick :)
I am not sure what sven meant by offscreen GLAD. The OffscreenAutoDrawable does not actually draw in my tests :( |
Free forum by Nabble | Edit this page |