示例#1
0
  public void display(GLAutoDrawable drawable) {
    GL gl = drawable.getGL();

    gl.glClear(GL.GL_COLOR_BUFFER_BIT);

    gl.glRasterPos2i(1, 1);
    gl.glDrawPixels(
        dim.width,
        dim.height, //
        GL.GL_RGB,
        GL.GL_UNSIGNED_BYTE,
        pixels);

    gl.glFlush();
  }
示例#2
0
  public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
    GL gl = drawable.getGL();

    gl.glViewport(0, 0, w, h);
    gl.glMatrixMode(GL.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glOrtho(0, w, 0, h, -1.0, 1.0);
    gl.glMatrixMode(GL.GL_MODELVIEW);
  }
示例#3
0
  public void init(GLAutoDrawable drawable) {
    GL gl = drawable.getGL();

    float m[] = {
      0.0f, 1.0f, 0.0f, 0.0f, //
      0.0f, 0.0f, 1.0f, 0.0f, //
      1.0f, 0.0f, 0.0f, 0.0f, //
      0.0f, 0.0f, 0.0f, 1.0f
    };

    pixels = readImage("Data/leeds.bin", dim);
    System.out.println(pixels.toString());

    gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    gl.glMatrixMode(GL.GL_COLOR);
    gl.glLoadMatrixf(m, 0);
    gl.glMatrixMode(GL.GL_MODELVIEW);
  }
    public void init(GLAutoDrawable glAutoDrawable) {
      StringBuilder sb = new StringBuilder();

      sb.append(gov.nasa.worldwind.Version.getVersion() + "\n");

      sb.append("\nSystem Properties\n");
      sb.append("Processors: " + Runtime.getRuntime().availableProcessors() + "\n");
      sb.append("Free memory: " + Runtime.getRuntime().freeMemory() + " bytes\n");
      sb.append("Max memory: " + Runtime.getRuntime().maxMemory() + " bytes\n");
      sb.append("Total memory: " + Runtime.getRuntime().totalMemory() + " bytes\n");

      for (Map.Entry prop : System.getProperties().entrySet()) {
        sb.append(prop.getKey() + " = " + prop.getValue() + "\n");
      }

      GL gl = glAutoDrawable.getGL();

      sb.append("\nOpenGL Values\n");

      String oglVersion = gl.glGetString(GL.GL_VERSION);
      sb.append("OpenGL version: " + oglVersion + "\n");

      String oglVendor = gl.glGetString(GL.GL_VENDOR);
      sb.append("OpenGL vendor: " + oglVendor + "\n");

      String oglRenderer = gl.glGetString(GL.GL_RENDERER);
      sb.append("OpenGL renderer: " + oglRenderer + "\n");

      int[] intVals = new int[2];
      for (Attr attr : attrs) {
        sb.append(attr.name).append(": ");

        if (attr.attr instanceof Integer) {
          gl.glGetIntegerv((Integer) attr.attr, intVals, 0);
          sb.append(intVals[0]).append(intVals[1] > 0 ? ", " + intVals[1] : "");
        }

        sb.append("\n");
      }

      String extensionString = gl.glGetString(GL.GL_EXTENSIONS);
      String[] extensions = extensionString.split(" ");
      sb.append("Extensions\n");
      for (String ext : extensions) {
        sb.append("    " + ext + "\n");
      }

      sb.append("\nJOGL Values\n");
      String pkgName = "javax.media.opengl";
      try {
        getClass().getClassLoader().loadClass(pkgName + ".GL");

        Package p = Package.getPackage(pkgName);
        if (p == null) {
          sb.append("WARNING: Package.getPackage(" + pkgName + ") is null\n");
        } else {
          sb.append(p + "\n");
          sb.append("Specification Title = " + p.getSpecificationTitle() + "\n");
          sb.append("Specification Vendor = " + p.getSpecificationVendor() + "\n");
          sb.append("Specification Version = " + p.getSpecificationVersion() + "\n");
          sb.append("Implementation Vendor = " + p.getImplementationVendor() + "\n");
          sb.append("Implementation Version = " + p.getImplementationVersion() + "\n");
        }
      } catch (ClassNotFoundException e) {
        sb.append("Unable to load " + pkgName + "\n");
      }

      this.outputArea.setText(sb.toString());
    }