aboutsummaryrefslogtreecommitdiffstats
path: root/make/gl-impl-CustomJavaCode-gl2_es2.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-07-25 16:26:27 +0000
committerSven Gothel <[email protected]>2008-07-25 16:26:27 +0000
commitdb40249b86a14c2178be8a2f61dc97f4ac1f1424 (patch)
treec570b317b13c11bf2e6b1c79d157aac24df32409 /make/gl-impl-CustomJavaCode-gl2_es2.java
parent4ce0d2396726dcd285f753fcacd0acc4e2b60469 (diff)
../jogl.log
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1735 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make/gl-impl-CustomJavaCode-gl2_es2.java')
-rw-r--r--make/gl-impl-CustomJavaCode-gl2_es2.java160
1 files changed, 160 insertions, 0 deletions
diff --git a/make/gl-impl-CustomJavaCode-gl2_es2.java b/make/gl-impl-CustomJavaCode-gl2_es2.java
index 064a8cb08..cdc5c3898 100644
--- a/make/gl-impl-CustomJavaCode-gl2_es2.java
+++ b/make/gl-impl-CustomJavaCode-gl2_es2.java
@@ -1,4 +1,106 @@
+ public String glGetShaderInfoLog(int shaderObj) {
+ int[] infoLogLength=new int[1];
+ glGetShaderiv(shaderObj, GL_INFO_LOG_LENGTH, infoLogLength, 0);
+
+ if(infoLogLength[0]==0) {
+ return "(InfoLog null)";
+ }
+ int[] charsWritten=new int[1];
+ byte[] infoLogBytes = new byte[infoLogLength[0]];
+ glGetShaderInfoLog(shaderObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0);
+
+ return new String(infoLogBytes, 0, charsWritten[0]);
+ }
+
+ public String glGetProgramInfoLog(int programObj) {
+ int[] infoLogLength=new int[1];
+ glGetProgramiv(programObj, GL_INFO_LOG_LENGTH, infoLogLength, 0);
+
+ if(infoLogLength[0]==0) {
+ return "(InfoLog null)";
+ }
+ int[] charsWritten=new int[1];
+ byte[] infoLogBytes = new byte[infoLogLength[0]];
+ glGetProgramInfoLog(programObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0);
+
+ return new String(infoLogBytes, 0, charsWritten[0]);
+ }
+
+ public boolean glIsShaderStatusValid(int shaderObj, int name) {
+ return glIsShaderStatusValid(shaderObj, name, null);
+ }
+ public boolean glIsShaderStatusValid(int shaderObj, int name, PrintStream verboseOut) {
+ int[] ires = new int[1];
+ glGetShaderiv(shaderObj, name, ires, 0);
+
+ boolean res = ires[0]==1;
+ if(!res && null!=verboseOut) {
+ verboseOut.println("Shader status invalid: "+glGetShaderInfoLog(shaderObj));
+ }
+ return res;
+ }
+ public boolean glIsShaderStatusValid(IntBuffer shaders, int name) {
+ return glIsShaderStatusValid(shaders, name, null);
+ }
+ public boolean glIsShaderStatusValid(IntBuffer shaders, int name, PrintStream verboseOut) {
+ boolean res = true;
+ shaders.rewind();
+ while(shaders.hasRemaining()) {
+ res = glIsShaderStatusValid(shaders.get(), name, verboseOut) && res;
+ }
+ shaders.rewind();
+ return res;
+ }
+
+ public boolean glIsProgramStatusValid(int programObj, int name) {
+ int[] ires = new int[1];
+ glGetProgramiv(programObj, name, ires, 0);
+
+ return ires[0]==1;
+ }
+
+ public boolean glIsProgramValid(int programObj) {
+ return glIsProgramValid(programObj, null);
+ }
+ public boolean glIsProgramValid(int programObj, PrintStream verboseOut) {
+ int[] ires = new int[1];
+ if(!glIsProgram(programObj)) {
+ if(null!=verboseOut) {
+ verboseOut.println("Program name invalid: "+programObj);
+ }
+ return false;
+ }
+ if(!glIsProgramStatusValid(programObj, GL_LINK_STATUS)) {
+ if(null!=verboseOut) {
+ verboseOut.println("Program link failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj));
+ }
+ return false;
+ }
+ if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) {
+ if(null!=verboseOut) {
+ verboseOut.println("Program status invalid: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj));
+ }
+ return false;
+ }
+ glValidateProgram(programObj);
+ if(!glIsProgramStatusValid(programObj, GL_VALIDATE_STATUS)) {
+ if(null!=verboseOut) {
+ verboseOut.println("Program validation failed: "+programObj+"\n\t"+ glGetProgramInfoLog(programObj));
+ }
+ return false;
+ }
+ return true;
+ }
+
+ public void glCreateShader(int type, IntBuffer shaders) {
+ shaders.clear();
+ while(shaders.hasRemaining()) {
+ shaders.put(glCreateShader(type));
+ }
+ shaders.rewind();
+ }
+
public void glShaderSource(int shader, java.lang.String[] source)
{
@@ -72,4 +174,62 @@
throw new GLException("Method \"glShaderBinaryOrSource\" without binary nor source");
}
+ public void glCompileShader(IntBuffer shaders)
+ {
+ shaders.rewind();
+ while(shaders.hasRemaining()) {
+ glCompileShader(shaders.get());
+ }
+ shaders.rewind();
+ }
+
+ public boolean glCreateCompileShader(IntBuffer shader, int shaderType,
+ int binFormat, java.nio.Buffer bin,
+ java.lang.String[][] sources)
+ {
+ return glCreateCompileShader(shader, shaderType,
+ binFormat, bin,
+ sources, null);
+ }
+
+ public boolean glCreateCompileShader(IntBuffer shader, int shaderType,
+ int binFormat, java.nio.Buffer bin,
+ java.lang.String[][] sources,
+ PrintStream verboseOut)
+ {
+ glCreateShader(shaderType, shader);
+
+ glShaderBinaryOrSource(shader, binFormat, bin, sources);
+
+ glCompileShader(shader);
+
+ return glIsShaderStatusValid(shader, GL_COMPILE_STATUS, verboseOut);
+ }
+
+ public void glAttachShader(int program, IntBuffer shaders)
+ {
+ shaders.rewind();
+ while(shaders.hasRemaining()) {
+ glAttachShader(program, shaders.get());
+ }
+ shaders.rewind();
+ }
+
+ public void glDetachShader(int program, IntBuffer shaders)
+ {
+ shaders.rewind();
+ while(shaders.hasRemaining()) {
+ glDetachShader(program, shaders.get());
+ }
+ shaders.rewind();
+ }
+
+ public void glDeleteShader(IntBuffer shaders) {
+ shaders.rewind();
+ while(shaders.hasRemaining()) {
+ glDeleteShader(shaders.get());
+ }
+ shaders.clear();
+ }
+