From 583c8c525b0691a0cb2a195ced20969b2e0ff57f Mon Sep 17 00:00:00 2001
From: Sven Gothel
- * In case the {@link TextureProvider} also implements {@link TextureProvider.SupportsImageTypes}, - * the {@link TextureProvider} is being mapped to its supporting {@link ImageType}s - * allowing an O(1) association. + * The {@link TextureProvider} is being mapped to its supporting {@link ImageType}s + * allowing an O(1) association, if {@link TextureProvider#} *
*/ public static void addTextureProvider(final TextureProvider provider) { @@ -712,12 +711,10 @@ public class TextureIO { // more optimal provider textureProviders.add(0, provider); - if( provider instanceof TextureProvider.SupportsImageTypes ) { - final ImageType[] imageTypes = ((TextureProvider.SupportsImageTypes)provider).getImageTypes(); - if( null != imageTypes ) { - for(int i=0; i+ * Use case: Mapping of {@link ImageType}s to {@link TextureProvider}. + *
*/ - public TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException; + ImageType[] getImageTypes(); /** * Produces a TextureData object from a stream, or returns null if @@ -143,44 +114,4 @@ public interface TextureProvider { int pixelFormat, boolean mipmap, String fileSuffix) throws IOException; - - /** - * Produces a TextureData object from a URL, or returns null if the - * file format was not supported by this TextureProvider. Does not - * do any OpenGL-related work. The resulting TextureData can be - * converted into an OpenGL texture in a later step. - * - * @param glp the OpenGL Profile this texture data should be - * created for. - * @param url the URL from which to read the texture data - * - * @param internalFormat the OpenGL internal format to be used for - * the texture, or 0 if it should be inferred - * from the file's contents - * - * @param pixelFormat the OpenGL pixel format to be used for - * the texture, or 0 if it should be inferred - * from the file's contents - * - * @param mipmap whether mipmaps should be produced for this - * texture either by autogenerating them or - * reading them from the file. Some file formats - * support multiple mipmaps in a single file in - * which case those mipmaps will be used rather - * than generating them. - * - * @param fileSuffix the file suffix to be used as a hint to the - * provider to more quickly decide whether it - * can handle the file, or null if the - * provider should infer the type from the - * file's contents - * - * @throws IOException if an error occurred while reading the URL - * @deprecated Use {@link #newTextureData(GLProfile, InputStream, int, int, boolean, String) - */ - public TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java index 5072c8c8f..8ee54899c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright (c) 2015 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 @@ -36,38 +37,29 @@ * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ - +// package com.jogamp.opengl.util.texture.spi.awt; -import java.awt.image.*; -import java.io.*; -import java.net.*; -import javax.imageio.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; + +import javax.imageio.ImageIO; + import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.util.texture.ImageType; +import com.jogamp.opengl.util.texture.TextureData; +import com.jogamp.opengl.util.texture.awt.AWTTextureData; +import com.jogamp.opengl.util.texture.spi.TextureProvider; import jogamp.opengl.Debug; -import com.jogamp.opengl.util.texture.*; -import com.jogamp.opengl.util.texture.awt.*; -import com.jogamp.opengl.util.texture.spi.*; public class IIOTextureProvider implements TextureProvider { private static final boolean DEBUG = Debug.debug("TextureIO"); @Override - public TextureData newTextureData(final GLProfile glp, final File file, - final int internalFormat, - final int pixelFormat, - final boolean mipmap, - final String fileSuffix) throws IOException { - final BufferedImage img = ImageIO.read(file); - if (img == null) { - return null; - } - if (DEBUG) { - System.out.println("TextureIO.newTextureData(): BufferedImage type for " + file + " = " + - img.getType()); - } - return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img); + public final ImageType[] getImageTypes() { + return null; } @Override @@ -86,18 +78,4 @@ public class IIOTextureProvider implements TextureProvider { } return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img); } - - @Override - public TextureData newTextureData(final GLProfile glp, final URL url, - final int internalFormat, - final int pixelFormat, - final boolean mipmap, - final String fileSuffix) throws IOException { - final InputStream stream = url.openStream(); - try { - return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix); - } finally { - stream.close(); - } - } } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 2cb6228ba..31a8e489e 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1061,10 +1061,10 @@ public abstract class GLContextImpl extends GLContext { */ protected static MappedGLVersion mapAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int profile, - final VersionNumber resVersion, final int resCtp, final GLRendererQuirks resQuirks) + final VersionNumber resVersion, final int resCtp, + final GLRendererQuirks resQuirks) { - @SuppressWarnings("deprecation") - final Integer preVal = mapAvailableGLVersion(device, reqMajor, profile, resVersion.getMajor(), resVersion.getMinor(), resCtp); + final Integer preVal = mapAvailableGLVersion(device, reqMajor, profile, resVersion, resCtp); final int[] preCtp = { 0 }; final VersionNumber preVersion = null != preVal ? decomposeBits(preVal.intValue(), preCtp) : null; final MappedGLVersion res = new MappedGLVersion(device, reqMajor, profile, resVersion, resCtp, resQuirks, preVersion, preCtp[0]); @@ -1073,6 +1073,26 @@ public abstract class GLContextImpl extends GLContext { } return res; } + private static Integer mapAvailableGLVersion(final AbstractGraphicsDevice device, + final int reqMajor, final int profile, final VersionNumber resVersion, int resCtp) + { + validateProfileBits(profile, "profile"); + validateProfileBits(resCtp, "resCtp"); + + if(FORCE_NO_FBO_SUPPORT) { + resCtp &= ~CTX_IMPL_FBO ; + } + if(DEBUG) { + System.err.println(getThreadName() + ": createContextARB-MapGLVersions MAP "+device+": "+reqMajor+" ("+GLContext.getGLProfile(new StringBuilder(), profile).toString()+ ") -> "+ + getGLVersion(resVersion.getMajor(), resVersion.getMinor(), resCtp, null)); + } + final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, profile); + final Integer val = Integer.valueOf(composeBits(resVersion.getMajor(), resVersion.getMinor(), resCtp)); + synchronized(deviceVersionAvailable) { + return deviceVersionAvailable.put( objectKey, val ); + } + } + protected static void remapAvailableGLVersions(final AbstractGraphicsDevice fromDevice, final AbstractGraphicsDevice toDevice) { if( fromDevice == toDevice || fromDevice.getUniqueID() == toDevice.getUniqueID() ) { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java index cc70b6b7b..84fce7fc9 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java @@ -72,27 +72,6 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple this.encapsulated=null; } - /** - * @deprecated Use {@link #create(GraphicsConfiguration, CapabilitiesImmutable, CapabilitiesImmutable)} - * Method constructs a new {@link AWTGraphicsConfiguration} primarily based - * on the given {@link Component}'s {@link GraphicsConfiguration}. - * @param awtComp the {@link Component}, which {@link GraphicsConfiguration} is used for the resulting {@link AWTGraphicsConfiguration} - * @param capsChosen if null,capsRequested
is copied and aligned
- * with the graphics {@link Capabilities} of the AWT Component to produce the chosen {@link Capabilities}.
- * Otherwise the capsChosen
is used.
- * @param capsRequested if null, default {@link Capabilities} are used, otherwise the given values.
- */
- public static AWTGraphicsConfiguration create(final Component awtComp, final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested) {
- if(null==awtComp) {
- throw new IllegalArgumentException("Null AWT Component");
- }
- final GraphicsConfiguration gc = awtComp.getGraphicsConfiguration();
- if( null == gc ) {
- throw new NativeWindowException("Null AWT GraphicsConfiguration @ "+awtComp);
- }
- return create(gc, capsChosen, capsRequested);
- }
-
/**
* Method constructs a new {@link AWTGraphicsConfiguration} primarily based
* on the given {@link GraphicsConfiguration}.
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java
index 2026ada0f..e5dcfa1c0 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java
@@ -97,24 +97,23 @@ public class AppContextInfo {
* The resulting thread name will have either '-OnAppContextTG' or '-OnSystemTG' appended
* @return the {@link Thread} used to invoke the runnable
, which may be the current {@link Thread} or a newly created one, see above.
*/
- public Thread invokeOnAppContextThread(final boolean waitUntilDone, final Runnable runnable, final String threadBaseName) {
- final Thread t;
+ public RunnableTask invokeOnAppContextThread(final boolean waitUntilDone, final Runnable runnable, final String threadBaseName) {
+ final RunnableTask rt;
if( update("invoke") ) {
- t = Thread.currentThread();
+ rt = RunnableTask.invokeOnCurrentThread(runnable);
if( DEBUG ) {
- System.err.println("Bug 1004: Invoke.0 on current AppContext thread: "+t+" "+toHexString(t.hashCode()));
+ System.err.println("Bug 1004: Invoke.0 on current AppContext: "+rt);
}
- runnable.run();
} else {
final ThreadGroup tg = getCachedThreadGroup();
final String tName = threadBaseName + ( null != tg ? "-OnAppContextTG" : "-OnSystemTG" );
- t = RunnableTask.invokeOnNewThread(tg, waitUntilDone, runnable, tName);
+ rt = RunnableTask.invokeOnNewThread(tg, tName, waitUntilDone, runnable);
if( DEBUG ) {
final int tgHash = null != tg ? tg.hashCode() : 0;
- System.err.println("Bug 1004: Invoke.1 on new AppContext thread: "+t+" "+toHexString(t.hashCode())+", tg "+tg+" "+toHexString(tgHash));
+ System.err.println("Bug 1004: Invoke.1 on new AppContext: "+rt+", tg "+tg+" "+toHexString(tgHash));
}
}
- return t;
+ return rt;
}
/**
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index 1dce7428f..71a7602e6 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -402,26 +402,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
return hasPixelScaleChanged;
}
}
- /**
- * @deprecated Use {@link #updatePixelScale(GraphicsConfiguration, boolean)}.
- */
- public final boolean updatePixelScale(final boolean clearFlag) {
- return updatePixelScale(awtConfig.getAWTGraphicsConfiguration(), clearFlag);
- }
-
- /**
- * @deprecated Use {@link #updateLockedData(JAWT_Rectangle, GraphicsConfiguration)}.
- */
- protected final boolean updateLockedData(final JAWT_Rectangle jawtBounds) {
- throw new RuntimeException("Invalid API entry");
- }
- /**
- * @deprecated Use {@link #lockSurfaceImpl(GraphicsConfiguration)}
- */
- protected int lockSurfaceImpl() throws NativeWindowException {
- throw new RuntimeException("Invalid API entry");
- }
-
/**
* Returns and clears the {@code hasPixelScaleChanged} flag, as set via {@link #lockSurface()}.
diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
index cc71fb559..4e9273e83 100644
--- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
+++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
@@ -54,41 +54,6 @@ import com.jogamp.newt.Screen;
public class NewtFactoryAWT extends NewtFactory {
public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window");
- /**
- * @deprecated Use {@link #getNativeWindow(java.awt.Component, AWTGraphicsConfiguration)}
- *
- * Wraps an AWT component into a {@link com.jogamp.nativewindow.NativeWindow} utilizing the {@link com.jogamp.nativewindow.NativeWindowFactory},
- * The actual wrapping implementation is {@link com.jogamp.nativewindow.awt.JAWTWindow}.
- * Purpose of this wrapping is to access the AWT window handle,
- * not to actually render into it.
- * Hence the dummy configuration only.