@Test
 public void testAvailableInfo() {
   GLDrawableFactory f = GLDrawableFactory.getDesktopFactory();
   if (null != f) {
     System.err.println(
         JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
   }
   f = GLDrawableFactory.getEGLFactory();
   if (null != f) {
     System.err.println(
         JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
   }
 }
示例#2
0
文件: GLWindow.java 项目: swkzr/jogl
  /** 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();
  }
示例#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();
  }