1package com.jogamp.opengl.test.junit.jogl.demos.gl2;
3import java.net.URLConnection;
5import com.jogamp.opengl.GL;
6import com.jogamp.opengl.GL2;
7import com.jogamp.opengl.GLAutoDrawable;
8import com.jogamp.opengl.GLEventListener;
9import com.jogamp.opengl.fixedfunc.GLLightingFunc;
10import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
12import com.jogamp.common.util.IOUtil;
13import com.jogamp.opengl.test.junit.jogl.util.texture.PNGTstFiles;
14import com.jogamp.opengl.util.gl2.GLUT;
15import com.jogamp.opengl.util.texture.Texture;
16import com.jogamp.opengl.util.texture.TextureIO;
31 private void enableStates(
final GL2 gl,
final boolean enable) {
75 final URLConnection urlConn = IOUtil.getResource(
"test-ntscP_3-01-160x90.png",
PNGTstFiles.class.getClassLoader(),
PNGTstFiles.class);
77 }
catch (
final Exception e) {
110 enableStates(gl,
true);
119 if( angleZ >= 180.0f ) {
121 }
else if (angleZ <= 0.0f ) {
126 enableStates(gl,
false);
136 gl.
glOrtho(-3.5, 3.5, -3.5 * h / w,
137 3.5 * h / w, -3.5, 3.5);
140 3.5 * w / h, -3.5, 3.5, -3.5, 3.5);
Adapted from http://www.java-tips.org/other-api-tips/jogl/how-to-draw-a-texture-mapped-teapot-with-au...
void dispose(final GLAutoDrawable gLDrawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void display(final GLAutoDrawable gLDrawable)
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 reshape(final GLAutoDrawable gLDrawable, final int x, final int y, final int w, final int h)
Called by the drawable during the first repaint after the component has been resized.
Subset of the routines provided by the GLUT interface.
void glutSolidTeapot(final double scale)
Renders the teapot as a solid shape of the specified size.
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.
void bind(final GL gl)
Binds this texture to the given GL context.
int getTarget()
Returns the OpenGL "target" of this texture.
void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val)
static final int GL_AUTO_NORMAL
GL_VERSION_1_0 Define "GL_AUTO_NORMAL" with expression '0x0D80', CType: int
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.
GL2 getGL2()
Casts this object to the GL2 interface.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
static final int GL_BACK
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_BACK" with expression...
static final int GL_REPEAT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_REPEAT" with expressi...
static final int GL_TEXTURE_2D
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE_2D" with expr...
static final int GL_TEXTURE_WRAP_S
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE_WRAP_S" with ...
void glBindTexture(int target, int texture)
Entry point to C language function: void {@native glBindTexture}(GLenum target, GLuint texture) Pa...
void glDisable(int cap)
Entry point to C language function: void {@native glDisable}(GLenum cap) Part of GL_ES_VERSION_2_0...
static final int GL_COLOR_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_COLOR_BUFFER_BIT" wit...
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
void glEnable(int cap)
Entry point to C language function: void {@native glEnable}(GLenum cap) Part of GL_ES_VERSION_2_0,...
static final int GL_DEPTH_TEST
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_TEST" with expr...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
static final int GL_CCW
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_CCW" with expression ...
static final int GL_CW
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_CW" with expression '...
static final int GL_FRONT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FRONT" with expressio...
void glFrontFace(int mode)
Entry point to C language function: void {@native glFrontFace}(GLenum mode) Part of GL_ES_VERSION_...
static final int GL_DEPTH_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_BUFFER_BIT" wit...
void glTexParameterf(int target, int pname, float param)
Entry point to C language function: void {@native glTexParameterf}(GLenum target,...
static final int GL_LESS
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_LESS" with expression...
static final int GL_CULL_FACE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_CULL_FACE" with expre...
void glFlush()
Entry point to C language function: void {@native glFlush}() Part of GL_ES_VERSION_2_0,...
void glCullFace(int mode)
Entry point to C language function: void {@native glCullFace}(GLenum mode) Part of GL_ES_VERSION_2...
void glDepthFunc(int func)
Entry point to C language function: void {@native glDepthFunc}(GLenum func) Part of GL_ES_VERSION_...
static final int GL_NORMALIZE
void glMaterialf(int face, int pname, float param)
static final int GL_LIGHTING
static final int GL_SHININESS
static final int GL_LIGHT0
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
void glPushMatrix()
Push the current matrix to it's stack, while preserving it's values.
void glPopMatrix()
Pop the current matrix from it's stack.
void glRotatef(float angle, float x, float y, float z)
Rotate the current matrix.
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.