diff options
author | Sven Gothel <[email protected]> | 2011-04-05 01:22:22 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-05 01:22:22 +0200 |
commit | 2d22d9a880fee84af422505e69c1642c7a505b0f (patch) | |
tree | 7e09dffb0f266ef30f6af31ed02c71b40a189ea7 /src/jogl/classes/com/jogamp/opengl | |
parent | 2e71f18aa514622b855a7f463a9d9f82b9e66d9f (diff) |
ShaderProgram: Add 'init(GL2ES2)', allowing GL program object creation before link stage.
This is required to allow proper usage of 'glBindAttribLocation()'.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java | 21 |
1 files changed, 21 insertions, 0 deletions
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"); |