/** * Loads a texture from the given source. * * @param source * the source of the texture image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param flipVertically * If true, the image is flipped vertically during image loading. * @return the loaded texture. */ public static Texture load(final ResourceSource source, final Texture.MinificationFilter minFilter, final boolean flipVertically) { return load(source, minFilter, TextureStoreFormat.GuessNoCompressedFormat, flipVertically); }
/** * Creates a texture from a given Ardor3D Image object. * * @param image * the Ardor3D image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param format * the specific format to use when storing this texture on the card. * @return the loaded texture. */ public static Texture loadFromImage(final Image image, final Texture.MinificationFilter minFilter, final TextureStoreFormat format) { final TextureKey key = TextureKey.getKey(null, false, format, "img_" + image.hashCode(), minFilter); return loadFromKey(key, image, null); }
/** * Creates a texture from a given Ardor3D Image object. * * @param image * the Ardor3D image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @return the loaded texture. */ public static Texture loadFromImage(final Image image, final Texture.MinificationFilter minFilter) { return loadFromImage(image, minFilter, TextureStoreFormat.GuessNoCompressedFormat); }
final Texture cached = TextureManager.findCachedTexture(texture.getTextureKey()); TextureManager.addToCache(texture); } else { final int textureId = cached.getTextureIdForContext(context);
public void cleanForContext(final RenderContext renderContext) { TextureManager.cleanAllTextures(null, renderContext, null); } });
/** * Delete any textures from the card that have been recently garbage collected in Java. If a deleter is passed in, * gc'd textures that are part of the currently active context (if one is active) will be deleted immediately. If a * deleter is not passed in, we do not have an active context, or we encounter gc'd textures that are not part of * the current context, then we will queue those textures to be deleted later using the GameTaskQueueManager. * * @param utils * if not null, this will be used to immediately delete any gc'd textures in the currently active * context. All other gc'd textures will be queued to delete in their own contexts. */ public static void cleanExpiredTextures(final ITextureUtils utils) { cleanExpiredTextures(utils, null); }
final Texture cached = TextureManager.findCachedTexture(texture.getTextureKey()); TextureManager.addToCache(texture); } else { final int textureId = cached.getTextureIdForContext(context.getGlContextRep());
public void cleanForContext(final RenderContext renderContext) { TextureManager.cleanAllTextures(null, renderContext, null); } });
/** * Delete any textures from the card that have been recently garbage collected in Java. If a deleter is passed in, * gc'd textures that are part of the currently active context (if one is active) will be deleted immediately. If a * deleter is not passed in, we do not have an active context, or we encounter gc'd textures that are not part of * the current context, then we will queue those textures to be deleted later using the GameTaskQueueManager. * * @param deleter * if not null, this renderer will be used to immediately delete any gc'd textures in the currently * active context. All other gc'd textures will be queued to delete in their own contexts. */ public static void cleanExpiredTextures(final Renderer deleter) { cleanExpiredTextures(deleter, null); }
/** * Loads a texture from the given source. * * @param source * the source of the texture image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param flipVertically * If true, the image is flipped vertically during image loading. * @return the loaded texture. */ public static Texture load(final ResourceSource source, final Texture.MinificationFilter minFilter, final boolean flipVertically) { return load(source, minFilter, TextureStoreFormat.GuessNoCompressedFormat, flipVertically); }
final Texture cached = TextureManager.findCachedTexture(texKey); TextureManager.addToCache(texture); } else { final int textureId = cached.getTextureIdForContext(context.getGlContextRep());
/** * Creates a texture from a given Ardor3D Image object. * * @param image * the Ardor3D image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param format * the specific format to use when storing this texture on the card. * @return the loaded texture. */ public static Texture loadFromImage(final Image image, final Texture.MinificationFilter minFilter, final TextureStoreFormat format) { final TextureKey key = TextureKey.getKey(null, false, format, "img_" + image.hashCode(), minFilter); return loadFromKey(key, image, null); }
/** * Creates a texture from a given Ardor3D Image object. * * @param image * the Ardor3D image. * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @return the loaded texture. */ public static Texture loadFromImage(final Image image, final Texture.MinificationFilter minFilter) { return loadFromImage(image, minFilter, TextureStoreFormat.GuessNoCompressedFormat); }
/** * Delete all textures from card. This will gather all texture ids believed to be on the card and try to delete * them. If a deleter is passed in, textures that are part of the currently active context (if one is active) will * be deleted immediately. If a deleter is not passed in, we do not have an active context, or we encounter textures * that are not part of the current context, then we will queue those textures to be deleted later using the * GameTaskQueueManager. * * @param utils * if not null, this will be used to immediately delete any textures in the currently active context. All * other textures will be queued to delete in their own contexts. */ public static void cleanAllTextures(final ITextureUtils utils) { cleanAllTextures(utils, null); }
/** * Handle detecting and scheduling cleanup of OpenGL assets. This method will place delete calls on the task queue * of appropriate RenderContexts when an asset such as a Texture is determined to no longer be reachable by Java. * * @param immediateDelete * an optional Renderer to use for immediate cleanup when the asset is owned by the current context. In * general this is best used in single context applications, and null is a perfectly acceptable value. */ public static void doRuntimeCleanup(final Renderer immediateDelete) { TextureManager.cleanExpiredTextures(immediateDelete, null); AbstractBufferData.cleanExpiredVBOs(immediateDelete); DisplayListDelegate.cleanExpiredDisplayLists(immediateDelete); }
protected void loadTexture(final String skinTexture) { try { _sharedTex = TextureManager.load(skinTexture, MinificationFilter.Trilinear, TextureStoreFormat.GuessNoCompressedFormat, false); } catch (final Exception e) { e.printStackTrace(); } }
final Texture cache = findCachedTexture(tkey); addToCache(result); return result;
/** * Convenience Utility for loading a BufferedImage as an Ardor3D Texture. * * @param image * our buffered image * @param minFilter * the filter for the near values. Used to determine if we should generate mipmaps. * @param flipVertically * If true, the image is flipped vertically during image conversion. * @param storeFormat * the specific format to use when storing this texture on the card. * @return our new Texture. */ public static final Texture loadTexture(final BufferedImage image, final Texture.MinificationFilter minFilter, final TextureStoreFormat storeFormat, final boolean flipVertically) { final Image imageData = AWTImageLoader.makeArdor3dImage(image, flipVertically); final String fileType = (image != null) ? "" + image.hashCode() : null; final TextureKey tkey = TextureKey.getKey(null, flipVertically, storeFormat, fileType, minFilter); return TextureManager.loadFromKey(tkey, imageData, null); } }
_styleName = capsule.readString("styleName", null); _pageTexture = (Texture) capsule.readSavable("pageTexture", null); _pageTexture = TextureManager.loadFromImage(_pageTexture.getImage(), _pageTexture.getMinificationFilter());
/** * Delete all textures from card. This will gather all texture ids believed to be on the card and try to delete * them. If a deleter is passed in, textures that are part of the currently active context (if one is active) will * be deleted immediately. If a deleter is not passed in, we do not have an active context, or we encounter textures * that are not part of the current context, then we will queue those textures to be deleted later using the * GameTaskQueueManager. * * @param deleter * if not null, this renderer will be used to immediately delete any textures in the currently active * context. All other textures will be queued to delete in their own contexts. */ public static void cleanAllTextures(final Renderer deleter) { cleanAllTextures(deleter, null); }