29package com.jogamp.opengl.test.junit.jogl.util;
31import java.io.InputStream;
32import java.net.URLConnection;
34import com.jogamp.common.util.IOUtil;
35import com.jogamp.opengl.test.junit.jogl.demos.TextureDraw01Accessor;
36import com.jogamp.opengl.test.junit.jogl.util.texture.PNGTstFiles;
37import com.jogamp.opengl.util.ImmModeSink;
38import com.jogamp.opengl.util.glsl.fixedfunc.FixedFuncUtil;
39import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode;
40import com.jogamp.opengl.util.texture.Texture;
41import com.jogamp.opengl.util.texture.TextureCoords;
42import com.jogamp.opengl.util.texture.TextureData;
43import com.jogamp.opengl.util.texture.TextureIO;
45import com.jogamp.opengl.GL;
46import com.jogamp.opengl.GL2ES1;
47import com.jogamp.opengl.GL2ES2;
48import com.jogamp.opengl.GLAutoDrawable;
49import com.jogamp.opengl.GLEventListener;
50import com.jogamp.opengl.GLPipelineFactory;
51import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
52import com.jogamp.opengl.glu.GLU;
55 private boolean debugFFPEmu =
false;
56 private boolean verboseFFPEmu =
false;
57 private boolean traceFFPEmu =
false;
58 private boolean forceFFPEmu =
false;
60 private final GLU glu =
new GLU();
63 boolean keepTextureBound;
67 this.keepTextureBound =
false;
70 public void setForceFFPEmu(
final boolean forceFFPEmu,
final boolean verboseFFPEmu,
final boolean debugFFPEmu,
final boolean traceFFPEmu) {
71 this.forceFFPEmu = forceFFPEmu;
72 this.verboseFFPEmu = verboseFFPEmu;
73 this.debugFFPEmu = debugFFPEmu;
74 this.traceFFPEmu = traceFFPEmu;
80 this.keepTextureBound = v;
100 final URLConnection testTextureUrlConn = IOUtil.getResource(
"test-ntscP_3-01-160x90.png",
PNGTstFiles.class.getClassLoader(),
PNGTstFiles.class);
102 final InputStream testTextureStream = testTextureUrlConn.getInputStream();
105 if( keepTextureBound &&
null != texture ) {
109 }
catch (
final Exception e) {
131 if(
null!=textureData) {
142 if( !keepTextureBound ) {
158 if( !keepTextureBound ) {
abstract GL setGL(GL gl)
Sets the GL pipeline object for this GLContext.
Factory for pipelining GL instances.
static final GL create(final String pipelineClazzBaseName, final Class<?> reqInterface, final GL downstream, final Object[] additionalArgs)
Creates a pipelined GL instance using the given downstream downstream and optional arguments addition...
Provides access to the OpenGL Utility Library (GLU).
void gluOrtho2D(float left, float right, float bottom, float top)
DemoGL2ES1TextureImmModeSink()
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void setKeepTextureBound(final boolean v)
void setForceFFPEmu(final boolean forceFFPEmu, final boolean verboseFFPEmu, final boolean debugFFPEmu, final boolean traceFFPEmu)
void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height)
Called by the drawable during the first repaint after the component has been resized.
final void glVertex3f(final float x, final float y, final float z)
static ImmModeSink createFixed(final int initialElementCount, final int vComps, final int vDataType, final int cComps, final int cDataType, final int nComps, final int nDataType, final int tComps, final int tDataType, final int glBufferUsage)
Uses a GL2ES1, or ES2 fixed function emulation immediate mode sink.
final void glTexCoord2f(final float x, final float y)
final void glEnd(final GL gl)
static final int GL_QUADS
Tool to pipeline GL2ES2 into a fixed function emulation implementing GL2ES1.
static final GL2ES1 wrapFixedFuncEmul(final GL gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix, final boolean force, final boolean verbose)
Specifies texture coordinates for a rectangular area of a texture.
Represents the data for an OpenGL texture.
void destroy()
Calls flush()
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.
static Texture newTexture(final TextureData data)
Creates an OpenGL texture object from the specified TextureData using the current OpenGL context.
Represents an OpenGL texture object.
TextureCoords getImageTexCoords()
Returns the set of texture coordinates corresponding to the entire image.
void bind(final GL gl)
Binds this texture to the given GL context.
void disable(final GL gl)
Disables this texture's target (e.g., GL_TEXTURE_2D) in the given GL state.
void enable(final GL gl)
Enables this texture's target (e.g., GL_TEXTURE_2D) in the given GL context's state.
void destroy(final GL gl)
Destroys and nulls the underlying native texture used by this Texture instance if owned,...
AUTO
Auto shader selection, based upon FFP states.
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
GL2ES1 getGL2ES1()
Casts this object to the GL2ES1 interface.
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.
GLContext getContext()
Returns the GLContext associated which this GL object.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
static final int GL_STATIC_DRAW
GL_VERSION_1_5, GL_ES_VERSION_2_0, GL_VERSION_ES_1_0, GL_ARB_vertex_buffer_object Alias for: GL_STATI...
static final int GL_FLOAT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FLOAT" with expressio...
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
static final int GL_MODELVIEW
Matrix mode modelview.
void glLoadIdentity()
Load the current matrix with the identity matrix.
void glMatrixMode(int mode)
Sets the current matrix mode.