28package com.jogamp.opengl.test.junit.jogl.glsl;
30import com.jogamp.opengl.test.junit.util.UITestCase;
31import com.jogamp.opengl.util.Animator;
33import com.jogamp.opengl.GL;
34import com.jogamp.opengl.GL2ES2;
35import com.jogamp.opengl.GL2GL3;
36import com.jogamp.opengl.GLAutoDrawable;
37import com.jogamp.opengl.GLCapabilities;
38import com.jogamp.opengl.GLEventListener;
39import com.jogamp.opengl.GLException;
40import com.jogamp.opengl.GLProfile;
41import com.jogamp.opengl.awt.GLCanvas;
45import org.junit.Assert;
46import org.junit.Assume;
47import org.junit.BeforeClass;
48import org.junit.AfterClass;
50import org.junit.FixMethodOrder;
51import org.junit.runners.MethodSorters;
57@FixMethodOrder(MethodSorters.NAME_ASCENDING)
59 static int width, height;
60 static long duration = 500;
84 final Frame frame =
new Frame(
"Bug 459 shader compilation test");
85 Assert.assertNotNull(frame);
88 Assert.assertNotNull(glCanvas);
94 final String code =
"void main(void){gl_Position = vec4(0,0,0,1);}";
103 final int[] compiled =
new int[1];
106 final int[] logLength =
new int[1];
109 final byte[] log =
new byte[logLength[0]];
112 System.err.println(
"Error compiling the shader: " +
new String(log));
117 System.out.println(
"Shader compiled: id=" +
id);
134 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) {
140 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
142 frame.setSize(512, 512);
143 frame.setVisible(
true);
145 }
catch(
final Exception ex) {
146 throw new RuntimeException(ex);
155 Assert.assertTrue( glexception !=
null ? glexception.getMessage() :
"", glexception ==
null );
156 Assert.assertNotNull(frame);
157 Assert.assertNotNull(glCanvas);
158 Assert.assertNotNull(animator);
161 Assert.assertEquals(
false, animator.isAnimating());
163 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
165 frame.setVisible(
false);
166 frame.remove(glCanvas);
169 }
catch(
final Throwable throwable ) {
170 throwable.printStackTrace();
171 Assume.assumeNoException( throwable );
175 public static void main(
final String args[]) {
Specifies a set of OpenGL capabilities.
void setStencilBits(final int stencilBits)
Sets the number of bits requested for the stencil buffer.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Specifies the the OpenGL profile.
static final String GL2GL3
The intersection of the desktop GL3 and GL2 profile.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
A heavyweight AWT component which provides OpenGL rendering support.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Duplicates bug 459, where a vertex shader won't compile when 8 bits of stencil are requested.
static void main(final String args[])
static void releaseClass()
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.
static final int GL_VERTEX_SHADER
GL_ES_VERSION_2_0, GL_VERSION_2_0, GL_EXT_vertex_shader, GL_ARB_vertex_shader Alias for: GL_VERTEX_SH...
void glCompileShader(int shader)
Entry point to C language function: void {@native glCompileShader}(GLuint shader) Part of GL_ES_VE...
void glDeleteShader(int shader)
Entry point to C language function: void {@native glDeleteShader}(GLuint shader) Part of GL_ES_VER...
static final int GL_COMPILE_STATUS
GL_ES_VERSION_2_0, GL_VERSION_2_0 Define "GL_COMPILE_STATUS" with expression '0x8B81',...
void glGetShaderiv(int shader, int pname, IntBuffer params)
Entry point to C language function: void {@native glGetShaderiv}(GLuint shader, GLenum pname,...
void glShaderSource(int shader, int count, String[] string, IntBuffer length)
Entry point to C language function: void {@native glShaderSource}(GLuint shader, GLsizei count,...
int glCreateShader(int type)
Entry point to C language function: GLuint {@native glCreateShader}(GLenum type) Part of GL_ES_VER...
void glGetShaderInfoLog(int shader, int bufSize, IntBuffer length, ByteBuffer infoLog)
Entry point to C language function: void {@native glGetShaderInfoLog}(GLuint shader,...
static final int GL_INFO_LOG_LENGTH
GL_ES_VERSION_2_0, GL_VERSION_2_0 Define "GL_INFO_LOG_LENGTH" with expression '0x8B84',...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
GL2GL3 getGL2GL3()
Casts this object to the GL2GL3 interface.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
static final int GL_FALSE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FALSE" with expressio...