29package com.jogamp.opengl.test.junit.util;
31import com.jogamp.opengl.util.glsl.ShaderUtil;
32import java.io.ByteArrayOutputStream;
33import java.io.PrintStream;
34import com.jogamp.opengl.GL;
35import com.jogamp.opengl.GL2ES2;
36import org.junit.Assert;
39 private int shaderProgram;
40 private int vertShader;
41 private int fragShader;
42 private boolean isValid;
44 private GLSLSimpleProgram(
final int shaderProgram,
final int vertShader,
final int fragShader) {
45 this.shaderProgram = shaderProgram;
46 this.vertShader = vertShader;
47 this.fragShader = fragShader;
52 final ByteArrayOutputStream baos =
new ByteArrayOutputStream();
53 final PrintStream pbaos =
new PrintStream(baos);
62 final int[] vlengths =
new int[] { vlines[0].length() };
66 System.out.println(
"getShader:postCompile vertShader: "+baos.toString());
67 Assert.assertTrue(
false);
69 pbaos.flush(); baos.reset();
74 final int[] flengths =
new int[] { flines[0].length() };
78 System.out.println(
"getShader:postCompile fragShader: "+baos.toString());
79 Assert.assertTrue(
false);
81 pbaos.flush(); baos.reset();
94 System.out.println(
"Error (GLSL link error): "+baos.toString());
95 Assert.assertTrue(
false);
121 return shaderProgram;
final String getGLSLVersionString()
Returns the matching GLSL version number, queried by this context GL via GL2ES2#GL_SHADING_LANGUAGE_V...
void release(final GL2ES2 gl)
static GLSLSimpleProgram create(final GL2ES2 gl, final String vertShaderCode, final String fragShaderCode, final boolean link)
static boolean isShaderStatusValid(final GL _gl, final int shaderObj, final int name, final PrintStream verboseOut)
static boolean isProgramLinkStatusValid(final GL _gl, final int programObj, final PrintStream verboseOut)
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...
void glDetachShader(int program, int shader)
Entry point to C language function: void {@native glDetachShader}(GLuint program,...
static final int GL_COMPILE_STATUS
GL_ES_VERSION_2_0, GL_VERSION_2_0 Define "GL_COMPILE_STATUS" with expression '0x8B81',...
int glCreateProgram()
Entry point to C language function: GLuint {@native glCreateProgram}() Part of GL_ES_VERSION_2_0,...
void glUseProgram(int program)
Entry point to C language function: void {@native glUseProgram}(GLuint program) Part of GL_ES_VERS...
void glShaderSource(int shader, int count, String[] string, IntBuffer length)
Entry point to C language function: void {@native glShaderSource}(GLuint shader, GLsizei count,...
void glAttachShader(int program, int shader)
Entry point to C language function: void {@native glAttachShader}(GLuint program,...
void glDeleteProgram(int program)
Entry point to C language function: void {@native glDeleteProgram}(GLuint program) Part of GL_ES_V...
int glCreateShader(int type)
Entry point to C language function: GLuint {@native glCreateShader}(GLenum type) Part of GL_ES_VER...
void glLinkProgram(int program)
Entry point to C language function: void {@native glLinkProgram}(GLuint program) Part of GL_ES_VER...
static final int GL_FRAGMENT_SHADER
GL_ES_VERSION_2_0, GL_VERSION_2_0, GL_ATI_fragment_shader, GL_ARB_fragment_shader Alias for: GL_FRAGM...
GLContext getContext()
Returns the GLContext associated which this GL object.
static final int GL_NO_ERROR
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_NO_ERROR" with expres...
int glGetError()
Entry point to C language function: GLenum {@native glGetError}() Part of GL_ES_VERSION_2_0,...