29package com.jogamp.opengl.test.junit.jogl.util.texture;
31import com.jogamp.newt.opengl.GLWindow;
32import com.jogamp.opengl.GLAutoDrawable;
33import com.jogamp.opengl.GLCapabilities;
34import com.jogamp.opengl.GLEventListener;
35import com.jogamp.opengl.GLProfile;
36import com.jogamp.opengl.test.junit.jogl.demos.TextureDraw01Accessor;
37import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureDraw01ES2Listener;
38import com.jogamp.opengl.test.junit.jogl.demos.gl2.TextureDraw01GL2Listener;
39import com.jogamp.opengl.test.junit.util.MiscUtils;
40import com.jogamp.opengl.test.junit.util.QuitAdapter;
41import com.jogamp.opengl.test.junit.util.UITestCase;
42import com.jogamp.opengl.util.Animator;
43import com.jogamp.opengl.util.GLReadBufferUtil;
44import com.jogamp.opengl.util.texture.ImageType;
45import com.jogamp.opengl.util.texture.TextureData;
46import com.jogamp.opengl.util.texture.TextureIO;
48import org.junit.Assert;
50import java.io.IOException;
51import java.io.InputStream;
54import org.junit.After;
55import org.junit.Before;
57import org.junit.FixMethodOrder;
58import org.junit.runners.MethodSorters;
60@FixMethodOrder(MethodSorters.NAME_ASCENDING)
62 static long duration = 100;
74 imageTstFiles.
clear();
77 public void testImpl(
final List<ImageTstFiles.NamedInputStream> streams,
final ImageType expImageType)
throws InterruptedException, IOException {
78 for(
int i=0; i<streams.size(); i++) {
79 final ImageTstFiles.NamedInputStream s = streams.get(i);
80 System.err.printf(
"Test %3d: path %s, exp-type %s%n", i, s.basePath, expImageType);
81 testImpl(s.stream, expImageType);
84 public void testImpl(
final InputStream istream,
final ImageType expImageType)
throws InterruptedException, IOException {
91 System.err.println(
"TextureData: "+texData);
95 glad.
setTitle(
"TestTextureIONEWT."+expImageType.type);
104 boolean shot =
false;
117 @Override
public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) { }
128 while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.
getTotalFPSDuration()<duration) {
156 public static void main(
final String args[])
throws IOException {
157 for(
int i=0; i<args.length; i++) {
158 if(args[i].equals(
"-time")) {
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void setTitle(final String title)
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
final boolean isGL2ES2()
Indicates whether this profile is capable of GL2ES2.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
ArrayList< NamedInputStream > jpgStreams
ArrayList< NamedInputStream > ddsStreams
ArrayList< NamedInputStream > tgaStreams
ArrayList< NamedInputStream > pngStreams
void testImpl(final InputStream istream, final ImageType expImageType)
void testImpl(final List< ImageTstFiles.NamedInputStream > streams, final ImageType expImageType)
static void main(final String args[])
static long atol(final String str, final long def)
final long getTotalFPSDuration()
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
Utility to read out the current FB to TextureData, optionally writing the data back to a texture obje...
Image type classification.
static final String T_TGA
Constant which can be used as a file suffix to indicate a Targa stream, value {@value}.
static final String T_PNG
Constant which can be used as a file suffix to indicate a PNG stream, value {@value}.
static final String T_DDS
Constant which can be used as a file suffix to indicate a DirectDraw Surface stream,...
static final String T_JPG
Constant which can be used as a file suffix to indicate a JPEG stream, value {@value}.
Represents the data for an OpenGL texture.
final ImageType getSourceImageType()
Returns the source ImageType if applicable and known, otherwise null.
int getHeight()
Returns the height in pixels of the texture data.
int getWidth()
Returns the width in pixels of the texture data.
static final String PNG
Constant which can be used as a file suffix to indicate a PNG file, value {@value}.
static TextureData newTextureData(final GLProfile glp, final File file, final boolean mipmap, String fileSuffix)
Creates a TextureData from the given file.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.