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();
 }
Beispiel #2
0
  /** Usage: java ...Tunnelblick [sensitivity=1.0 [useopenni=false]] */
  public static void main(String[] argv) {
    float sensitivity = 1.0f;
    boolean withOpenNi = false;
    if (argv.length >= 1) sensitivity = Float.valueOf(argv[0]).floatValue();
    if (argv.length >= 2) withOpenNi = Boolean.valueOf(argv[1]);
    OpenNiBodyTrackerInputDriver onbtid =
        withOpenNi ? new OpenNiBodyTrackerInputDriver(true) : null;
    GameManager man = new GameManager("Tunnelblick", 800, 600);
    KeyboardGestureInputDriver kgid = new KeyboardGestureInputDriver();
    kgid.bind(java.awt.event.KeyEvent.VK_SPACE, InputEvent.GESTURE_JUMP);
    man.installInputDriver(kgid);
    MouseButtonGestureInputDriver mbgid = new MouseButtonGestureInputDriver();
    mbgid.bind(java.awt.event.MouseEvent.BUTTON1, InputEvent.GESTURE_JUMP);
    man.installInputDriver(mbgid);
    ModalMouseMotionInputDriver mmmid = new ModalMouseMotionInputDriver();
    mmmid.setPointerMode(false);
    man.installInputDriver(mmmid);
    if (withOpenNi) man.installInputDriver(onbtid);

    Tunnelblick state = new Tunnelblick(man);
    state.getPlayer().setSensitivity(sensitivity);
    man.setState(state);
    man.run();
    man.destroy();
  }