From 2d22d9a880fee84af422505e69c1642c7a505b0f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 5 Apr 2011 01:22:22 +0200 Subject: ShaderProgram: Add 'init(GL2ES2)', allowing GL program object creation before link stage. This is required to allow proper usage of 'glBindAttribLocation()'. --- .../com/jogamp/opengl/util/glsl/ShaderProgram.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/jogl') diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java index 131858271..b6908c1a1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -172,6 +172,27 @@ public class ShaderProgram { return true; } + /** + * Creates the empty GL program object using {@link GL2ES2#glCreateProgram()} + * + * @param gl + */ + public final void init(GL2ES2 gl) { + if(0>shaderProgram) { + shaderProgram = gl.glCreateProgram(); + } + } + + /** + * Compiles and links the shader code to the program. + * Within this process, all GL resources (shader and program objects) are created if necessary. + * + * @param gl + * @param verboseOut + * @return + * + * @see #init(GL2ES2) + */ public synchronized boolean link(GL2ES2 gl, PrintStream verboseOut) { if(programLinked) throw new GLException("Program is already linked"); -- cgit v1.2.3