コード例 #1
0
ファイル: ShaderUtil.java プロジェクト: Karlqu/jogl
 /** 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();
 }
コード例 #2
0
ファイル: Error_t.java プロジェクト: adoggie/Koala-Messaging
public class Error_t {
  // -- STRUCT --
  public Boolean succ = Boolean.valueOf(false);
  public Integer code = Integer.valueOf(0);
  public String msg = "";

  // 构造函数
  public Error_t() {}

  // return xml string
  public boolean marshall(DataOutputStream d) {
    try {
      d.writeByte(succ.booleanValue() ? 1 : 0);
      d.writeInt(code);
      byte[] sb_1 = msg.getBytes();
      d.writeInt(sb_1.length);
      d.write(sb_1, 0, sb_1.length);
    } catch (Exception e) {
      return false;
    }
    return true;
  }

  public boolean unmarshall(ByteBuffer d) {
    boolean r = false;
    try {
      byte v_1 = d.get();
      this.succ = v_1 == 0 ? false : true;
      this.code = d.getInt();
      int v_2 = d.getInt();
      byte[] _sb_3 = new byte[v_2];
      d.get(_sb_3);
      this.msg = new String(_sb_3);
    } catch (Exception e) {
      tce.RpcCommunicator.instance().getLogger().error(e.getMessage());
      r = false;
      return r;
    }
    return true;
  }
  // --  end function --

}