Beispiel #1
0
 /** Returns true if a hader compiler is available, otherwise false. */
 public static boolean isShaderCompilerAvailable(final GL _gl) {
   final GL2ES2 gl = _gl.getGL2ES2();
   final ProfileInformation info = getProfileInformation(gl);
   if (null == info.shaderCompilerAvailable) {
     if (gl.isGLES2()) {
       boolean queryOK = false;
       try {
         final byte[] param = new byte[1];
         gl.glGetBooleanv(GL2ES2.GL_SHADER_COMPILER, param, 0);
         final int err = gl.glGetError();
         boolean v = GL.GL_NO_ERROR == err && param[0] != (byte) 0x00;
         if (!v) {
           final Set<Integer> bfs = getShaderBinaryFormats(gl);
           if (bfs.size() == 0) {
             // no supported binary formats, hence a compiler must be available!
             v = true;
           }
         }
         info.shaderCompilerAvailable = Boolean.valueOf(v);
         queryOK = true;
       } catch (final GLException gle) {
         System.err.println("Caught exception on thread " + Thread.currentThread().getName());
         gle.printStackTrace();
       }
       if (!queryOK) {
         info.shaderCompilerAvailable = Boolean.valueOf(true);
       }
     } else if (gl.isGL2ES2()) {
       info.shaderCompilerAvailable = new Boolean(true);
     } else {
       throw new GLException("Invalid OpenGL profile");
     }
   }
   return info.shaderCompilerAvailable.booleanValue();
 }