aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
Commit message (Collapse)AuthorAgeFilesLines
* jogl: remove all trailing whitespaceHarvey Harrison2013-10-171-71/+71
| | | | Signed-off-by: Harvey Harrison <[email protected]>
* TiledPrintingAWTBase: Fix scaling - Fit frame to page, add MSAA ↵Sven Gothel2013-09-071-1/+1
| | | | | | | | | | | | | | RenderingHints test; setupPrint(Graphics2D): Query RenderingHints to use MSAA rendering - AWTPrintLifecycle.setupPrint(Graphics2D): Query RenderingHints to use MSAA rendering - Impl. in GLCanvas - TODO GLJPanel (would need a new offscreen buffer) - TiledPrintingAWTBase: - Fix scaling - Fit frame to page - add MSAA RenderingHints test - GLCanvas: Remove dumpStack() DEBUG output
* GLFBODrawableImpl.initialize(): Unrealize when already unrealized shall not ↵Sven Gothel2013-08-101-1/+8
| | | | throw an exception - only dump DEBUG info!
* Remedy for Bug 782: Issue Debug.initSingleton() or Debug.debug(..) before ↵Sven Gothel2013-07-171-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | calling 'PropertyAccess.isPropertyDefined(propName, default)' through Debug class. Calling 'Debug.isPropertyDefined(propName, default)' may be 'optimized' to 'PropertyAccess.isPropertyDefined(propName, default)', which would skip the modules Debug's class initialization. Iff that happens, an AccessControlException may happen, due to requesting an insecure property, since modules own Debug class has not been added it's trusted prefixes from within it's init block yet. This seems to be a bug of the JVM .. to me, however .. the above description is the only able to explain the issue at hand. +++ Fix calls Debug class own static methods, either Debug.initSingleton() or Debug.debug(), before calling 'isPropertyDefined(propName, default)'. +++ Also mark Debug class static methods final! +++
* GLFBODrawableImpl: Fix swap criteria, i.e. don't swap in ↵Sven Gothel2013-06-171-10/+17
| | | | contextMadeCurrent(false) if already swapped by swapBuffersImpl(..), but always swap in swapBuffersImpl(..) if ctx is current and associated.
* FBObject.init() uses safe 1x1 size like reset(..) to behave equal; ↵Sven Gothel2013-04-121-17/+16
| | | | GLFBODrawableImpl.contextMadeCurrent(ctx, true): Throw exception if !initialized
* Debug Messages: Unify getThreadName() usage and 'Catched Exception' messagesSven Gothel2013-04-101-1/+1
|
* Bug 665: Allow re-association of GLContext/GLEventListener to a GLDrawable ↵Sven Gothel2013-03-131-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Part 4) Note: - GLEventListenerState preservs the GLAutoDrawable state, i.e. GLContext, all GLEventListener and the GLAnimatorControl association. - GLEventListenerState may be utilized to move the state from a dying GLAutoDrawable, to be moved to a new created GLAutoDrawable at a later time. - GLEventListenerState will be made public soon. +++ Exessive unit tests cover the new feature, tested manually on GNU/Linux/X11 and OSX(Java6/Java7). +++ - GLAutoDrawable - Change 'setContext(..)' to allow the destruction of the unbound old context: 'setContext(GLContext newCtx)' -> 'setContext(GLContext newCtx, boolean destroyPrevCtx)' - Implementations: Properly implement 'setRealized(..)' incl. obeying threading constraints if exists. Method is being utilized at least for GLEventListenerState.moveTo(..) to unrealize and realize the drawable resources. +++ Fix propagation of GLContext/GLDrawable association change (Bottom -> Top): GLDrawableImpl.associateContext GLContextImpl.associateDrawable GLContextImpl.makeCurrent GLContextImpl.destroy GLContext.setGLDrawable ... GLDrawableHelper.switchContext GLAutoDrawble.setContext associateDrawable(..)/associateContext(..) unifies and hence: - GLContextImpl.contextRealized() (removed) - GLDrawableImpl.contextRealized() (removed) - GLDrawableImpl.associateContext(..) (merged) - MacOSXCGLContext.drawableChangedNotify(..) (removed) +++ - EGLUpstreamSurfaceHook.evalUpstreamSurface() validates the surface's device for reusage, which is valid in case of GLEventListenerState.moveTo(..) - MacOSXCGLContext.NSOpenGLImpl: pixelFormat replaces NSOpenGLLayerPfmt and has simplified lifecycle [create..destroy], while native NSOpenGLLayer code only holds the reference until released.
* FBObject/GLFBODrawableImpl: Silence stderr if not in DEBUG mode relying on ↵Sven Gothel2013-01-261-16/+19
| | | | | | | | | | | application handling verbosity and debug output The following cases were dumping states on stderr: - FBOObject.isStatusValid() if false -> Only dumps if DEBUG - GLFBODrawableImpl.reset() if fboResetQuirk becomes true and 1st time in ClassLoader -> Only dumps if DEBUG
* Cleanup GLContext special entries: getOffscreenContextPixelDataType(), ↵Sven Gothel2012-12-151-0/+14
| | | | | | | | | | | | | | | | | | | | | | | getOffscreenContextReadBuffer(), .. ; Add GLFBODrawable API entries for multi buffering (no impl. yet); GLJPanel 1st simplification using offscreen drawable - Cleanup GLContext special entries: getOffscreenContextPixelDataType(), getOffscreenContextReadBuffer(), .. ; - add: getDefaultReadBuffer() (-> exposed via GLBase as well) - add: isGLOrientationFlippedVertical() - add: getDefaultPixelDataType() - removed impl: getOffscreenContextPixelDataType() - removed impl: getOffscreenContextReadBuffer() - removed impl: offscreenImageNeedsVerticalFlip() - Add GLFBODrawable API entries for multi buffering (no impl. yet); - TODO: Add implementation code in GLFBODrawableImpl - GLJPanel 1st simplification using FBO - Use above new GL/GLContext entries - Fix: getNativeSurface() and getHandle() - TODO: - Remove distinction of 'pbuffer' and 'software', - Use GLDrawableFactory.createOffscreenDrawable(..) - Use GL for FBO swapping
* GLFBODrawableImpl: Following suit w/ commit ↵Sven Gothel2012-11-061-1/+1
| | | | | | | b83b068c0f426f24a58e2bd9f52de9ebd0c7876d, sync GL command stream before FBO reconfig Even though we currently have no bug experienced on this, it seems to be a good idea for highly concurrently GL driver implementations.
* FBO ResetQuirk: Dump only brief information (OS, GL, JOGL sha1), the latter ↵Sven Gothel2012-10-131-5/+11
| | | | becomes public method to JoglVersion
* Fix Bug 617 (part2): Workaround buggy GPU driver where FBO reattachment of ↵Sven Gothel2012-10-061-22/+43
| | | | | | | | | | | | | | | | | | | Colorbuffer w/ diff size leads to GL_FRAMEBUFFER_UNSUPPORTED. This occured at least on: - OS X 10.6.8 - GL_RENDERER NVIDIA GeForce 7300 GT OpenGL Engine - GL_VERSION 2.1 NVIDIA-1.6.36 Remedy is to catch the exception @ GLFBODrawableImpl.reset(..) and switch over to fallback 'reset' method: FBO reattachment -> FBO complete recreation Of course, the FBO recreation is noticable slower, but at least it seems to work on the offending system. Not tested on the offending system, but manually provoked GLException on FBOObject to trigger fallback, which is working here.
* Refine ed7d5f2e3fc696d47b10c8d62a071643bf385588, set and restore FBO caps @ ↵Sven Gothel2012-10-051-7/+12
| | | | | | | setRealized(true/false) already, refine at initialize(true) Allowing to validate the on-/offscreen state after setRealized(true). Adding comment in GLFBODrawable.
* FBO/Offscreen: Use most simple GLCapabilities for GLFBODrawableImpl's ↵Sven Gothel2012-10-051-18/+24
| | | | | | | | | | | | | | | | | underlying dummy surface/drawable If stencil or MSAA has been selected, the underlying dummy drawable doesn't need to have this configuration, i.e. doesn't need to waste the resources. - Creation of the dummy surface/drawable uses a simple GLCapabilities - Requested FBO GLCapabilities is being passes down to the dummy drawable - GLFBODrawableImpl ctor leaves caps untouched - GLFBODrawableImpl.initialize(boolean realize) - realize == true: using the requested FBO caps and setting it in the parent dummy drawable - realize == false: restore the original caps of dummy drawable
* FBObject/GLFBODrawable: Debug / glError detectionSven Gothel2012-10-021-4/+10
| | | | | | | - Enh. Debug output a bit - FBObject: Detect glError @ syncFramebuffer MSAA blit, throw GLException if glError to fail-fast - TODO: May add Mesa NoFBOMSAA Quirk to disable even trying it ..
* FBObject: Clarify reset(..), resetSamplingSink(..) ; Rename ↵Sven Gothel2012-09-271-4/+4
| | | | | | | | | | | syncFramebuffer(..) -> syncSamplingSink(..) - reset(..) adds a new argument, boolean resetSamplingSink, allowing to trigger a reset on the samplink sink as well. Use cases are documented. - made public: resetSamplingSink() - Rename syncFramebuffer(..) -> syncSamplingSink(..) to clarify semantics
* GLFBODrawableImpl: Fix garbage @ swap, add [disabled] reset-quirk for testingSven Gothel2012-09-201-17/+48
| | | | | | | | | Fix garbage @ swap: Reset the front buffer _after_ swap. Add [disabled] reset-quirk for testing: On some OSX GPUs (old NV 7xxx only ?), reconfig/resize of FBO fails, recreate whole FBO w/ quirk enabled.
* Seamless Integration of an FBObject based GLFBODrawable as ↵Sven Gothel2012-09-151-81/+415
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLOffscreenAutoDrawable.FBO and as an OffscreenLayerSurface's drawable (OSX) - Fix Bugs 569 and 599 Summary: ========= The new FBObject based GLFBODrawable implementation allows the seamless utilization of FBO offscreen rendering in single buffer, double buffer and MSAA mode. The GLFBODrawable uses a parent drawable based on a dummy surface to allow a GLOffscreenAutoDrawable.FBO creation or a mutable surface supporting an existing offscreen layer surface (OSX CALayer). Offscreen GLDrawable's and GLOffscreenAutoDrawable's can be selected via the GLCapabilities. If simply !onscreen is selected in the caps instance w/o enabling FBO, PBuffer or Bitmap, the factory will automatically choose regarding availability: FBO > PBuffer > Bitmap Double buffering is supported in MSAA more (intrinsic) and explicit in non MSAA. It is preferred when delivering resources (texture id's or framebuffer names) to a shared GLContext. This is demonstrated in (emulates our OSX CALayer implementation): TestFBOOffThreadSharedContextMix2DemosES2NEWT, TestFBOOnThreadSharedContext1DemoES2NEWT and with the OSX JAWT OffscreenLayerSurface itself. FBO is the preferred choice. +++ Offscreen drawables can be resized while maintaining a bound GLContext (e.g. w/ GLAutoDrawable). Previously both, drawable and context, needed to be destroyed and recreated at offscreen resize. Common implementation in GLDrawableHelper is used in the implementations (NEWT's GLWindow, AWT GLCanvas, SWT GLCanvas). +++ Tested: ======= Manually run all unit tests on: - Linux x86_64 NVidia/AMD/Mesa3d(ES) - OSX x86_64 NVidia - Windows x86_64 NVidia - Android arm Mali-400/Tegra-2 No regressions. Disclaimer: =========== This feature is committed almost in one patch. Both previous commits were introducing / fixing the capabilities behavior: 90d45928186f2be99999461cfe45f76a783cc961 9036376b7806a5fc61590bf49404eb71830de92f I have to appologize for the huge size and impact (files and platforms) of this commit however, I could not find a better way to inject this feature in one sane piece. NativeWindow Details: ===================== Complete decoupling of platform impl. detail of surfaces implementing ProxySurface. Used to generalize dummy surfaces and EGL surfaces on top of a native platform surface. - ProxySurface.UpstreamSurfaceHook -> UpstreamSurfaceHook - abstract class ProxySurface -> interface ProxySurface + ProxySurfaceImpl - Misc. implementations JOGL Details: ===================== FBOObject: API Change / Simplification & Usability - Removed reference counter to remove complexity, allow user to choose. - Add 'dispose' flag for detachColorbuffer(..), allowing to keep attachment alive - Fix equals operation of Attachment - Check pre-exising GL errors - Interface Colobuffer gets lifecycle methods - Add static factory methods to create Attachments w/o FBObject instance - Reset: - Clip min size to 1 - Keep alive samplingSink, i.e. don't issue resetMSAATexture2DSink(..). It gets called at syncFramebuffer()/use(..) later on before actual usage. This allows the consumer to utilize the GL_FRONT buffer until (e.g.) swap. - misc bugfixes GLOffscreenAutoDrawable: API Change - Reloc and interfacing - class com.jogamp.opengl.OffscreenAutoDrawable -> javax.media.opengl.* interfaces GLOffscreenAutoDrawable extends GLAutoDrawable GLOffscreenAutoDrawable.FBO extends GLOffscreenAutoDrawable, GLFBODrawable - Added general implementation and FBO specialization - Replacing GLPBuffer (deprecated) .. usable for any offscreen GLDrawable via factory GLAutoDrawable: - Add 'GLDrawable getDelegatedDrawable()' - Refine documentation of setContext(..), remove disclaimer and fixme tags GLDrawableFactory: - Refine API doc and it's selection mechanism for offscreen. - Add createOffscreenDrawable(..) - Add createOffscreenAutoDrawable(..) - Add canCreateFBO(..) - Mark createGLPbuffer(..) deprectated Mark GLPBuffer deprecated New: GLFBODrawable extends GLDrawable GLCanvas (AWT and SWT): Add offscreen resize support w/o GLContext recreation GLAutoDrawableBase .. GLWindow: - Add offscreen resize support w/o GLContext recreation - Remove double swapBuffer call - GLBase/GLContext: - Add: - boolean hasBasicFBOSupport() - boolean hasFullFBOSupport() - int getMaxRenderbufferSamples() - boolean isTextureFormatBGRA8888Available() GLContext: Fix version detection and hasGLSL() - Version detection in setGLFunctionAvailability(..) - Query GL_VERSION ASAP and parse it and compare w/ given major/minor - Use parsed version if valid and lower than given _or_ given is invalid. - Use validated version for caching (procaddr, ..), version number, etc. - Fix hasGLSL() Since 'isGL2ES2()' is true if 'isGL2()' and the latter simply alows GL 1.*, we confine the result to a GL >= 2.0 on desktops. FIXME: May consider GL 1.5 w/ extensions. - return isGL2ES2(); + return isGLES2() || + isGL3() || + isGL2() && ctxMajorVersion>1 ; GLDrawableImpl: - Add 'associateContext(GLContext, boolean)' allowing impl. to have a (weak) reference list of bound context. This is was pulled up from the OSX specific drawable impl. - swapBuffersImpl() -> swapBuffersImpl(boolean doubleBuffered) and call it regardless of single buffering. This is required to propagate this event to impl. properly, i.e. FBODrawable requires a swap notification. - Clarify 'contextMadeCurrent(..)' protocol GLDrawableHelper: - Add resize and recreate offscreen drawable util method - Simplify required init/reshape calls for GLEventListener - GLGraphicsConfigurationUtil: - fixWinAttribBitsAndHwAccel: Reflect sharede context hw-accel bits - OSX has no offscreen bitmap, use pbuffer - use proper offscreen auto selection if offscreen and no modes are set EGL Context/Drawable/DrawableFactory: Abstract native platform code out of base classes - Use EGLWrappedSurface w/ UpstreamSurfaceHook to handle upstream (X11, WGL, ..) lifecycle - in case the EGL resource is hooked up on it. Invisible dummy surfaces: All platforms - size is now reduced to 64x64 and decoupled of actual generic mutable size - fix device lifecycle, no more leaks +++ OSX ==== Enable support for GLFBODrawableImpl in offscreen CALayer mode - NSOpenGLImpl: hooks to calayer native code - calayer code: - allows pbuffer and texures (FBO) - decouple size and draw calls avoiding flickering - enable auto resize of calayer tree MacOSXCGLContext: - NSOpenGLImpl: - Fix false pbuffer 'usage', validate the pointer - If !pbuffer, copy other window mode bits of caps - MacOSXCGLGraphicsConfiguration: - Only assume pbuffer if !onscreen - Remove reference of native pixelformat pointer Native code: - use 'respondsToSelector:' query before calling 'new' methods avoiding an error message where unsuported (prev. OSX versions) - if monitor refresh-rate is queried 0, set to default 60hz - add missing NSAutoreleasePool decoration +++ Android / NEWT: =============== Issue setVisible(..) w/o wait, i.e. queue on EDT, @Android surfaceChanged() callback. Otherwise we could deadlock: setVisible(..) -> EDT -> setVisibleImpl(..) -> 'GL-display'. the latter may may cause havoc while Android-EDT is blocked [until it's return].
* Robostness: GLDrawableImpl's contextMadeCurrent()/contextRealized() ; ↵Sven Gothel2012-08-171-1/+5
| | | | | | | | | | | | | | | GLFBODrawableImpl.contextMadeCurrent(false), OffscreenAutoDrawable.setSize(..) GLDrawableImpl's contextMadeCurrent()/contextRealized(): - Catch exception which may appear during callback and cont. w/ GLContextImpl's release()/destroy() while throwing catched exception at end. GLFBODrawableImpl.contextMadeCurrent(false): - Detect null Colorbuffer ASAP and throw exception OffscreenAutoDrawable.setSize(..): - Catch exceptions at 1) GLFBODrawableImpl.setSize(..) and 2) GLContext.release() .. throw it in proper order.
* Bug 599 - FBObject / Offscreen Support - Part 1Sven Gothel2012-07-191-0/+138
- New FBObject implementation handling FBO and it's attachments *** API CHANGE: Util -> Core *** while it's size and sample-count can be reconfigured on the fly. - com.jogamp.opengl.util.FBObject -> com.jogamp.opengl.FBObject - agnostic to texture unit - separate attachments using OO hierarchy reflecting FBO - handling MSAA and blitting - no FBO destruction for reconfig (attach/detach) - New GLFBODrawableImpl impl. an FBObject based GLDrawable - Instantiated by a dummy native surface (onscreen and invisible) hooked up to a dummy GLDrawable, which is the delegation for context creation. - Utilizies ProxySurface.UpstreamSurfaceHook for dummy surface avoiding specialization for native platforms. - TODO: Allow to utilize common surface interface as a dummy-surface to supporting API seperation of windowing/GL. The latter allows impl. of createGLDrawable(NativeSurface) with FBO. - New OffscreenAutoDrawable (extends GLAutoDrawableDelegate) for all offscreen drawables. Shall replace GLPbuffer. - New GLCapabilities*.isFBO() / setFBO(boolean) to request FBO offscreen, similar to isPBuffer(). Rule: if both are requested, FBO shall be favored. - GLContext adds raw FBO availability query (min. FBO avail), FBObject contains fine grained queries (TODO: Move parts to GLContext for efficiency). - Add framebuffer tracking, allowing fast querying: - GLBase/GLContext: public int getBoundFramebuffer(int target); public int getDefaultDrawFramebuffer(); public int getDefaultReadFramebuffer(); - GLContextImpl public final void setBoundFramebuffer(int target, int framebufferName) .. called by GL impl bind framebuffer - GL: getDefaultDrawFramebuffer(), getDefaultReadFramebuffer() Adding default framebuffer queries being issued by GL.glBindFramebuffer(target, 0) w/ a default framebuffer, o.e. zero. This allows a transparent use of a custom FBO even in case the applications attempts to reset FBO to zero. Value flow: GL <- GLContext <- GLDrawable, - GLCapabilities handle fbo/pbuffer seperate, don't disable the other - GLContext/GL track read/write framebuffer to be queried by FBObject to determine whether to bind/unbind a framebuffer - Test cases for multiple FBO w/ and w/o MSAA Other Features: - New interface ProxySurface.UpstreamSurfaceHook, allowing to hook an upstream surface of unknown type providing lifecycle and information (size, ..) callbacks. Used for all new dummy NativeSurface impl and SWT GLCanvas. - GLContext -> GLDrawable propagation context/drawable lifecycle via ProxySurface.UpstreamSurfaceHook allowing dynamic resources to react (create, init, ..) - contextRealized() - contextMadeCurrent() - SurfaceChangeable -> MutableSurface currently only contains setting the surface handle. TODO: May need to move ProxySurface.UpstreamSurfaceHook -> MutableSurface.UpstreamSurfaceHook, allowing other impl. classes (NEWT OffscreenWindow) to utilize the new upstream hookup mechanism - will allow FBO/Dummy window to work. - SWT GLCanvas using ProxySurface.UpstreamSurfaceHook for proper size propagation. - New GLAutoDrawable::getUpstreamWidget(), allowing GLEventListener to fetch the owning Java side UI element (NEWT, SWT, AWT, ..). - GLDrawableFactory: Removed createOffscreenSurface() - unused and not GL related - EGLDrawableFactory handles device/profile avail. mapping while actually creating context/drawable. This allows us to learn whether the ES context is software/hardware as well as FBO avail. - EGLDrawable: Removed secret buckets of EGL configs :) Employ native surface (X11, WGL, ..) to EGL 'mapping' in EGLDrawableFactory utilizing new EGLUpstreamSurfaceHook (implements ProxySurface.UpstreamSurfaceHook). Other Bugs: - Add CTX_OPTION_DEBUG to ctx/extension cache key since only a debug ctx may expose the ARB debug capability. This bug caused lack of ARB/AMD debug functionality. - Fix GLProfile deadlock (debug mode, w/ EGL/ES, no X11), dump availability information _after_ lock. - ImmModeSink draw(): Use GL's glDrawElements(..), don't cast for GL2ES1. Fixes use for GL2ES2. - Fix KeyEvent.getKeyChar() comment (-> only stable for keyTyped(..)) Misc: - Refined alot of API doc - New GLExtensions holds commonly used GL extension strings, allows better referencing and usage lookup. - Move GL (interface) decl. to GLBase - GLBuffers: Cleanup API doc (format, types) - TextureIO: Add PAM and PPM static suffix identifier - GLCapabilities getNumSamples() returns 0 if sampleBuffers is disabled, this seems to be more natural. - finalized a lot