Summary: | Add ability to create multiple shared dummy AutoDrawable in GLDrawableFactory | ||
---|---|---|---|
Product: | [JogAmp] Jogl | Reporter: | Stefan Arisona <robot> |
Component: | opengl | Assignee: | Sven Gothel <sgothel> |
Status: | RESOLVED INVALID | ||
Severity: | enhancement | ||
Priority: | --- | ||
Version: | 2.3.2 | ||
Hardware: | All | ||
OS: | all | ||
Type: | FEATURE | SCM Refs: | |
Workaround: | --- |
Description
Stefan Arisona
2015-09-11 13:12:42 CEST
See: com.jogamp.opengl.GLSharedContextSetter You probably use the wrong API! Copy/Paste from above API doc: +++ // GLProfile and GLCapabilities should be equal across all shared GL drawable/context. final GLCapabilitiesImmutable caps = ... ; final GLProfile glp = caps.getGLProfile(); .. final boolean createNewDevice = true; // use 'own' display device! final GLAutoDrawable sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, createNewDevice, caps, null); sharedDrawable.display(); // triggers GLContext object creation and native realization. ... // Later a shared 'slave' can be created e.g.: GLWindow glad = GLWindow.create(caps); // or any other GLAutoDrawable supporting GLSharedContextSetter glad.setSharedAutoDrawable(sharedDrawable); glad.addGLEventListener(..); glad.setVisible(true); // GLWindow creation .. +++ See all unit tests: com.jogamp.opengl.test.junit.jogl.acore.TestSharedContext* My apologies if I haven't been enough precise. I am aware of the API to create shared contexts. Maybe to start with, our application scenario is as follows: - We have a number of (visible) windows, each with a shared context - We have a pool of threads, each requiring a shared context to perform background tasks such as shader compiling, texture loading, etc. So far, we're using the mechanism that you pasted to create a dummy context, and then a window for each context required, together with setSharedContext(). However, the issue is that for the background threads we need to initially perform setVisible(true) to realise the context, and then hide them again. It's ugly and not very elegant. My understanding is that it's not possible to realise a context without making the window visible first. Instead we would rather see a possibility to create multiple "dummy" contexts for which we don't need to show a window. Alternatively, what would be other options? (In reply to comment #2) > My apologies if I haven't been enough precise. I am aware of the API to > create shared contexts. > > Maybe to start with, our application scenario is as follows: > > - We have a number of (visible) windows, each with a shared context > - We have a pool of threads, each requiring a shared context to perform > background tasks such as shader compiling, texture loading, etc. > > So far, we're using the mechanism that you pasted to create a dummy context, > and then a window for each context required, together with > setSharedContext(). > > However, the issue is that for the background threads we need to initially > perform setVisible(true) to realise the context, and then hide them again. > It's ugly and not very elegant. My understanding is that it's not possible > to realise a context without making the window visible first. > > Instead we would rather see a possibility to create multiple "dummy" > contexts for which we don't need to show a window. > > Alternatively, what would be other options? The referenced 'dummy drawable' does not show a window. Hence no window is visible - or shall be visible for the 'shared master resource'. (In reply to comment #1) > See: com.jogamp.opengl.GLSharedContextSetter > > You probably use the wrong API! > > Copy/Paste from above API doc: > +++ > // GLProfile and GLCapabilities should be equal across all shared GL > drawable/context. > final GLCapabilitiesImmutable caps = ... ; > final GLProfile glp = caps.getGLProfile(); > .. > final boolean createNewDevice = true; // use 'own' display device! > final GLAutoDrawable sharedDrawable = > GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, > createNewDevice, caps, null); > sharedDrawable.display(); // triggers GLContext object creation and > native realization. ^^ this one! Besides the many unit tests, also see GLMediaPlayerImpl. If this still is not what you meant .. please refine your question. Also note: We also offer commercial support in case we are talking about a commercial company project. <http://jogamp.org/wiki/index.php/Maintainer_and_Contacts#Sven_Gothel> Just in case .. you like to support us a bit and/or need more help for adopting our software. Thanks... What I'd need: A number of OpenGL Contexts with window (visible) A number of OpenGL Context without window (or window not ever visible) All these contexts shared. Re services: Thanks - it's an academic project, but we might start contributing to JOGL at some point. Cheers /Stefan (In reply to Stefan Arisona from comment #5) > Thanks... > > What I'd need: > > A number of OpenGL Contexts with window (visible) > > A number of OpenGL Context without window (or window not ever visible) > > All these contexts shared. You can do that w/ the described API as demonstrated w/ the referenced unit tests. > > > Re services: Thanks - it's an academic project, but we might start > contributing to JOGL at some point. Looking forward to merging your contributions, sounds great! Thank you! > > Cheers /Stefan Cheers, Sven PS: Academic must not indicate that there is no budget :) PS2: We always need to find the cow to feed us :) |