/** * Copyright 2014 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ package jogamp.opengl.egl; import java.nio.IntBuffer; import com.jogamp.nativewindow.NativeSurface; import com.jogamp.nativewindow.NativeWindow; import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.ProxySurface; import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.opengl.GLException; import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.opengl.egl.EGL; import jogamp.nativewindow.ProxySurfaceImpl; import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.GLDrawableImpl; /** *
* EGLSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a * EGLUpstreamSurfaceHook [ is_a -> UpstreamSurfaceHook.MutableSize -> UpstreamSurfaceHook ] has_a * NativeSurface (e.g. native [X11, WGL, ..] surface, or WrappedSurface, ..) **/ public class EGLSurface extends WrappedSurface { static boolean DEBUG = EGLDrawable.DEBUG || ProxySurface.DEBUG; public static EGLSurface get(final NativeSurface surface) { if(surface instanceof EGLSurface) { return (EGLSurface)surface; } return new EGLSurface(surface); } private EGLSurface(final NativeSurface surface) { super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); if(EGLDrawableFactory.DEBUG) { System.err.println("EGLSurface.ctor().1: "+this); ProxySurfaceImpl.dumpHierarchy(System.err, this); } } public static EGLSurface createWrapped(final EGLGraphicsConfiguration cfg, final long handle, final UpstreamSurfaceHook upstream, final boolean ownsDevice) { return new EGLSurface(cfg, handle, upstream, ownsDevice); } private EGLSurface(final EGLGraphicsConfiguration cfg, final long handle, final UpstreamSurfaceHook upstream, final boolean ownsDevice) { super(cfg, EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(cfg, handle, upstream, ownsDevice), false /* tbd in UpstreamSurfaceHook */); if(EGLDrawableFactory.DEBUG) { System.err.println("EGLSurface.ctor().2: "+this); ProxySurfaceImpl.dumpHierarchy(System.err, this); } } public static EGLSurface createSurfaceless(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) { return new EGLSurface(cfg, upstream, ownsDevice); } private EGLSurface(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) { super(cfg, EGL.EGL_NO_SURFACE, upstream, ownsDevice); if(EGLDrawableFactory.DEBUG) { System.err.println("EGLSurface.ctor().3: "+this); ProxySurfaceImpl.dumpHierarchy(System.err, this); } } /** * Entry point to C language function: *
EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint * attrib_list)
EGL_VERSION_1_0
* EGLSurface eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void * native_window, const EGLAttrib * attrib_list)
Part of EGL_VERSION_1_5
, EGL_EXT_platform_base
Alias for: eglCreatePlatformWindowSurfaceEXT
*