JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
TextureProvider.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright (c) 2015 JogAmp Community. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * - Redistribution of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * - Redistribution in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of Sun Microsystems, Inc. or the names of
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * This software is provided "AS IS," without a warranty of any kind. ALL
21 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
22 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
23 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
24 * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
25 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
26 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
27 * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
28 * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
29 * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
30 * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
31 * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 * You acknowledge that this software is not designed or intended for use
34 * in the design, construction, operation or maintenance of any nuclear
35 * facility.
36 *
37 * Sun gratefully acknowledges that this software was originally authored
38 * and developed by Kenneth Bradley Russell and Christopher John Kline.
39 */
40
41package com.jogamp.opengl.util.texture.spi;
42
43import java.io.IOException;
44import java.io.InputStream;
45
46import com.jogamp.opengl.GLProfile;
47import com.jogamp.opengl.util.texture.ImageType;
48import com.jogamp.opengl.util.texture.TextureData;
49
50
51/** Plug-in interface to TextureIO to support reading OpenGL textures
52 from new file formats. For all methods, either internalFormat or
53 pixelFormat may be 0 in which case they must be inferred as
54 e.g. RGB or RGBA depending on the file contents.
55*/
56
57public interface TextureProvider {
58
59 /**
60 * Optional additional interface for {@link TextureProvider} implementation
61 * exposing the supported {@link ImageType}s.
62 * <p>
63 * Use case: Mapping of {@link ImageType}s to {@link TextureProvider}.
64 * </p>
65 */
66 public static interface SupportsImageTypes {
67 /** Returns the supported {@link ImageType}s. */
69 }
70
71 /**
72 * Returns the known supported {@link ImageType}s, or {@code null} if unknown.
73 * <p>
74 * Use case: Mapping of {@link ImageType}s to {@link TextureProvider}.
75 * </p>
76 */
78
79 /**
80 * Produces a TextureData object from a stream, or returns null if
81 * the file format was not supported by this TextureProvider. Does
82 * not do any OpenGL-related work. The resulting TextureData can be
83 * converted into an OpenGL texture in a later step.
84 *
85 * @param glp the OpenGL Profile this texture data should be
86 * created for.
87 * @param stream the stream from which to read the texture data
88 *
89 * @param internalFormat the OpenGL internal format to be used for
90 * the texture, or 0 if it should be inferred
91 * from the file's contents
92 *
93 * @param pixelFormat the OpenGL pixel format to be used for
94 * the texture, or 0 if it should be inferred
95 * from the file's contents
96 *
97 * @param mipmap whether mipmaps should be produced for this
98 * texture either by autogenerating them or
99 * reading them from the file. Some file formats
100 * support multiple mipmaps in a single file in
101 * which case those mipmaps will be used rather
102 * than generating them.
103 *
104 * @param fileSuffix the file suffix to be used as a hint to the
105 * provider to more quickly decide whether it
106 * can handle the file, or null if the
107 * provider should infer the type from the
108 * file's contents
109 *
110 * @throws IOException if an error occurred while reading the stream
111 */
112 public TextureData newTextureData(GLProfile glp, InputStream stream,
113 int internalFormat,
114 int pixelFormat,
115 boolean mipmap,
116 String fileSuffix) throws IOException;
117}
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
Image type classification.
Definition: ImageType.java:42
Represents the data for an OpenGL texture.
Optional additional interface for TextureProvider implementation exposing the supported ImageTypes.
ImageType[] getImageTypes()
Returns the supported ImageTypes.
Plug-in interface to TextureIO to support reading OpenGL textures from new file formats.
TextureData newTextureData(GLProfile glp, InputStream stream, int internalFormat, int pixelFormat, boolean mipmap, String fileSuffix)
Produces a TextureData object from a stream, or returns null if the file format was not supported by ...
ImageType[] getImageTypes()
Returns the known supported ImageTypes, or null if unknown.