Beispiel #1
0
 public static void main(final String args[]) {
   System.err.println(VersionUtil.getPlatformInfo());
   System.err.println(GlueGenVersion.getInstance());
   // System.err.println(NativeWindowVersion.getInstance());
   System.err.println(OVRVersion.getInstance());
   System.err.println(OVRVersion.getAllAvailableCapabilitiesInfo(null).toString());
 }
Beispiel #2
0
  /** A most simple JOGL AWT test entry */
  public static void main(String args[]) {
    System.err.println(VersionUtil.getPlatformInfo());
    System.err.println(GlueGenVersion.getInstance());
    System.err.println(JoglVersion.getInstance());

    System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, true).toString());

    final GLProfile glp = GLProfile.getDefault();
    final GLCapabilitiesImmutable caps = new GLCapabilities(glp);

    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setSize(128, 128);

    glWindow.addGLEventListener(
        new GLEventListener() {
          @Override
          public void init(GLAutoDrawable drawable) {
            GL gl = drawable.getGL();
            System.err.println(JoglVersion.getGLInfo(gl, null));
            System.err.println(
                "Requested: "
                    + drawable
                        .getNativeSurface()
                        .getGraphicsConfiguration()
                        .getRequestedCapabilities());
            System.err.println("Chosen   : " + drawable.getChosenGLCapabilities());
          }

          @Override
          public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}

          @Override
          public void display(GLAutoDrawable drawable) {}

          @Override
          public void dispose(GLAutoDrawable drawable) {}
        });

    glWindow.setVisible(true);
    glWindow.destroy();
  }
Beispiel #3
0
  /** A most simple JOGL AWT test entry */
  public static void main(String args[]) {
    final boolean forceES2;
    final boolean forceES3;
    final boolean forceGL3;
    final boolean forceGL4ES3;
    {
      boolean _forceES2 = false;
      boolean _forceES3 = false;
      boolean _forceGL3 = false;
      boolean _forceGL4ES3 = false;
      if (null != args) {
        for (int i = 0; i < args.length; i++) {
          if (args[i].equals("-es2")) {
            _forceES2 = true;
          } else if (args[i].equals("-es3")) {
            _forceES3 = true;
          } else if (args[i].equals("-gl3")) {
            _forceGL3 = true;
          } else if (args[i].equals("-gl4es3")) {
            _forceGL4ES3 = true;
          }
        }
      }
      forceES2 = _forceES2;
      forceES3 = _forceES3;
      forceGL3 = _forceGL3;
      forceGL4ES3 = _forceGL4ES3;
    }
    System.err.println("forceES2    " + forceES2);
    System.err.println("forceES3    " + forceES3);
    System.err.println("forceGL3    " + forceGL3);
    System.err.println("forceGL4ES3 " + forceGL4ES3);

    System.err.println(VersionUtil.getPlatformInfo());
    System.err.println(GlueGenVersion.getInstance());
    System.err.println(JoglVersion.getInstance());

    System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, true).toString());

    final GLProfile glp;
    if (forceGL4ES3) {
      glp = GLProfile.get(GLProfile.GL4ES3);
    } else if (forceGL3) {
      glp = GLProfile.get(GLProfile.GL3);
    } else if (forceES3) {
      glp = GLProfile.get(GLProfile.GLES3);
    } else if (forceES2) {
      glp = GLProfile.get(GLProfile.GLES2);
    } else {
      glp = GLProfile.getDefault();
    }
    final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
    System.err.println("Requesting: " + caps);

    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setSize(128, 128);

    glWindow.addGLEventListener(
        new GLEventListener() {
          @Override
          public void init(GLAutoDrawable drawable) {
            GL gl = drawable.getGL();
            System.err.println(JoglVersion.getGLInfo(gl, null));
            System.err.println(
                "Requested: "
                    + drawable
                        .getNativeSurface()
                        .getGraphicsConfiguration()
                        .getRequestedCapabilities());
            System.err.println("Chosen   : " + drawable.getChosenGLCapabilities());
            System.err.println("GL impl. class " + gl.getClass().getName());
            if (gl.isGL4ES3()) {
              GL4ES3 _gl = gl.getGL4ES3();
              System.err.println("GL4ES3 retrieved, impl. class " + _gl.getClass().getName());
            }
            if (gl.isGL3()) {
              GL3 _gl = gl.getGL3();
              System.err.println("GL3 retrieved, impl. class " + _gl.getClass().getName());
            }
            if (gl.isGLES3()) {
              GLES3 _gl = gl.getGLES3();
              System.err.println("GLES3 retrieved, impl. class " + _gl.getClass().getName());
            }
            if (gl.isGLES2()) {
              GLES2 _gl = gl.getGLES2();
              System.err.println("GLES2 retrieved, impl. class " + _gl.getClass().getName());
            }
          }

          @Override
          public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}

          @Override
          public void display(GLAutoDrawable drawable) {}

          @Override
          public void dispose(GLAutoDrawable drawable) {}
        });

    glWindow.setVisible(true);
    glWindow.destroy();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setFullscreenFeature(getWindow(), true);

    final android.view.ViewGroup viewGroup =
        new android.widget.FrameLayout(getActivity().getApplicationContext());
    getWindow().setContentView(viewGroup);

    final TextView tv = new TextView(getActivity());
    final ScrollView scroller = new ScrollView(getActivity());
    scroller.addView(tv);
    viewGroup.addView(
        scroller,
        new android.widget.FrameLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));

    tv.setText(
        VersionUtil.getPlatformInfo()
            + Platform.NEWLINE
            + GlueGenVersion.getInstance()
            + Platform.NEWLINE
            + JoglVersion.getInstance()
            + Platform.NEWLINE);

    // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
    GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setUndecorated(true);
    glWindow.setSize(32, 32);
    glWindow.setPosition(0, 0);
    final android.view.View androidGLView =
        ((WindowDriver) glWindow.getDelegatedWindow()).getAndroidView();
    viewGroup.addView(
        androidGLView,
        new android.widget.FrameLayout.LayoutParams(
            glWindow.getWidth(), glWindow.getHeight(), Gravity.BOTTOM | Gravity.RIGHT));
    registerNEWTWindow(glWindow);

    glWindow.addGLEventListener(
        new GLEventListener() {
          public void init(GLAutoDrawable drawable) {
            GL gl = drawable.getGL();
            final StringBuffer sb = new StringBuffer();
            sb.append(JoglVersion.getGLInfo(gl, null)).append(Platform.NEWLINE);
            sb.append("Requested: ").append(Platform.NEWLINE);
            sb.append(
                    drawable
                        .getNativeSurface()
                        .getGraphicsConfiguration()
                        .getRequestedCapabilities())
                .append(Platform.NEWLINE)
                .append(Platform.NEWLINE);
            sb.append("Chosen: ").append(Platform.NEWLINE);
            sb.append(drawable.getChosenGLCapabilities())
                .append(Platform.NEWLINE)
                .append(Platform.NEWLINE);
            viewGroup.post(
                new Runnable() {
                  public void run() {
                    tv.append(sb.toString());
                    viewGroup.removeView(androidGLView);
                  }
                });
          }

          public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}

          public void display(GLAutoDrawable drawable) {}

          public void dispose(GLAutoDrawable drawable) {}
        });
    glWindow.setVisible(true);
    Log.d(MD.TAG, "onCreate - X");
  }