diff options
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/egl')
4 files changed, 27 insertions, 26 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java index 7eeb19141..f9fcdb29c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 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 @@ -50,7 +51,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { protected long eglSurface; protected EGLDrawable(EGLDrawableFactory factory, - NativeWindow component) throws GLException { + NativeSurface component) throws GLException { super(factory, component, false); eglSurface=EGL.EGL_NO_SURFACE; eglDisplay=0; @@ -86,19 +87,19 @@ public abstract class EGLDrawable extends GLDrawableImpl { System.err.println("createSurface using eglDisplay 0x"+Long.toHexString(eglDisplay)+", "+eglConfig); } - eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), component.getSurfaceHandle()); + eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), surface.getSurfaceHandle()); if (EGL.EGL_NO_SURFACE==eglSurface) { throw new GLException("Creation of window surface failed: "+eglConfig+", error 0x"+Integer.toHexString(EGL.eglGetError())); } if(DEBUG) { - System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getSurfaceHandle())+" -> 0x"+Long.toHexString(eglSurface)); + System.err.println("setSurface using component: handle 0x"+Long.toHexString(surface.getSurfaceHandle())+" -> 0x"+Long.toHexString(eglSurface)); } } protected void setRealizedImpl() { if (realized) { - AbstractGraphicsConfiguration aConfig = component.getGraphicsConfiguration().getNativeGraphicsConfiguration(); + AbstractGraphicsConfiguration aConfig = surface.getGraphicsConfiguration().getNativeGraphicsConfiguration(); AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice(); if(aDevice instanceof EGLGraphicsDevice) { if(DEBUG) { @@ -116,10 +117,10 @@ public abstract class EGLDrawable extends GLDrawableImpl { } int[] tmp = new int[1]; - if ( 0 != component.getSurfaceHandle() && - EGL.eglQuerySurface(eglDisplay, component.getSurfaceHandle(), EGL.EGL_CONFIG_ID, tmp, 0) ) { - // component holds static EGLSurface - eglSurface = component.getSurfaceHandle(); + if ( 0 != surface.getSurfaceHandle() && + EGL.eglQuerySurface(eglDisplay, surface.getSurfaceHandle(), EGL.EGL_CONFIG_ID, tmp, 0) ) { + // surface holds static EGLSurface + eglSurface = surface.getSurfaceHandle(); if(DEBUG) { System.err.println("setSurface re-using component's EGLSurface: handle 0x"+Long.toHexString(eglSurface)); } @@ -145,7 +146,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { long nDisplay=0; if( NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) { - nDisplay = component.getSurfaceHandle(); // don't even ask .. + nDisplay = surface.getSurfaceHandle(); // don't even ask .. } else { nDisplay = aDevice.getHandle(); // 0 == EGL.EGL_DEFAULT_DISPLAY } @@ -219,7 +220,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { public String toString() { return getClass().getName()+"[realized "+isRealized()+ ",\n\tfactory "+getFactory()+ - ",\n\twindow "+getNativeWindow()+ + ",\n\tsurface "+getNativeSurface()+ ",\n\teglSurface 0x"+Long.toHexString(eglSurface)+ ",\n\teglConfig "+eglConfig+ ",\n\trequested "+getRequestedGLCapabilities()+ diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java index 72498a7af..b1084dd8f 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 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 @@ -40,7 +41,7 @@ import javax.media.opengl.*; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.NullWindow; +import com.jogamp.nativewindow.impl.ProxySurface; public class EGLDrawableFactory extends GLDrawableFactoryImpl { @@ -114,14 +115,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected final GLDrawableImpl getSharedDrawable() { return null; } protected final GLContextImpl getSharedContext() { return null; } - public GLDrawableImpl createOnscreenDrawable(NativeWindow target) { + public GLDrawableImpl createOnscreenDrawable(NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } return new EGLOnscreenDrawable(this, target); } - protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) { + protected GLDrawableImpl createOffscreenDrawable(NativeSurface target) { throw new GLException("Not yet implemented"); } @@ -129,14 +130,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return true; } - protected GLDrawableImpl createGLPbufferDrawableImpl(NativeWindow target) { + protected GLDrawableImpl createGLPbufferDrawableImpl(NativeSurface target) { return new EGLPbufferDrawable(this, target); } - protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { - NullWindow nw = new NullWindow(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capabilities, chooser)); - nw.setSize(width, height); - return nw; + protected NativeSurface createOffscreenSurface(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { + ProxySurface ns = new ProxySurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capabilities, chooser)); + ns.setSize(width, height); + return ns; } public GLContext createExternalGLContext() { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java index 551a21ed6..820ac04e9 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 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 @@ -41,12 +42,9 @@ package com.jogamp.opengl.impl.egl; import javax.media.opengl.*; import javax.media.nativewindow.*; -import javax.media.nativewindow.egl.*; -import com.jogamp.opengl.impl.*; -import com.jogamp.nativewindow.impl.NullWindow; public class EGLOnscreenDrawable extends EGLDrawable { - protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeWindow component) throws GLException { + protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeSurface component) throws GLException { super(factory, component); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java index 03b02b77e..5b7509c43 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2010 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 @@ -48,12 +49,12 @@ public class EGLPbufferDrawable extends EGLDrawable { private int texFormat; protected static final boolean useTexture = false; // No yet .. - protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeWindow target) { + protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeSurface target) { super(factory, target); ownEGLDisplay = true; // get choosen ones .. - GLCapabilities caps = (GLCapabilities) getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); + GLCapabilities caps = (GLCapabilities) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities(); if(useTexture) { this.texFormat = caps.getAlphaBits() > 0 ? EGL.EGL_TEXTURE_RGBA : EGL.EGL_TEXTURE_RGB ; @@ -62,7 +63,7 @@ public class EGLPbufferDrawable extends EGLDrawable { } if (DEBUG) { - System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration()); + System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); } setRealized(true); @@ -74,7 +75,7 @@ public class EGLPbufferDrawable extends EGLDrawable { } protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) { - NativeWindow nw = getNativeWindow(); + NativeSurface nw = getNativeSurface(); int[] attrs = EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(nw.getWidth(), nw.getHeight(), texFormat); long surf = EGL.eglCreatePbufferSurface(eglDpy, eglNativeCfg, attrs, 0); if (EGL.EGL_NO_SURFACE==surf) { |