@Override
  public void init(GLAutoDrawable pDrawable) {
    // Use debug pipeline
    // drawable.setGL(new DebugGL(drawable.getGL()));

    GL2 gl = pDrawable.getGL().getGL2();
    // System.err.println("INIT GL IS: " + gl.getClass().getName());

    checkRequiredExtensions(gl);

    // Enable VSync
    gl.setSwapInterval(1);

    // Setup the drawing area and shading mode
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    gl.glClearDepth(1.0);
    // sky blue color
    gl.glClearColor(0.17f, 0.65f, 0.92f, 0.0f);

    gl.glEnable(GL.GL_DEPTH_TEST);
    // int[] depth_bits = new int[1];
    // gl.glGetIntegerv(GL.GL_DEPTH_BITS, depth_bits, 0);

    gl.glShadeModel(GLLightingFunc.GL_SMOOTH);

    float[] grayCol = {0.8f, 0.8f, 0.8f, 1.0f};
    // float[] blueCol = {0.0f, 0.0f, 0.8f, 1.0f};
    gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_AMBIENT_AND_DIFFUSE, grayCol, 0);

    // this.modelRender = ModelRender.getInstance();

    axisLabels.init();
    renderJosm.init(gl);
    // selectionDrawUtil.init(gl);
    compass.init(gl);

    lightRender.init(gl);
  }
Exemple #2
0
  /* (non-Javadoc)
   * @see com.jogamp.opengl.GLEventListener#init(com.jogamp.opengl.GLAutoDrawable)
   */
  @Override
  public void init(GLAutoDrawable glDrawable) {
    // get the OpenGL context
    GL2 gl = glDrawable.getGL().getGL2();

    // set the matrix mode to projection
    gl.glMatrixMode(GL2.GL_PROJECTION);
    // initialize the matrix
    gl.glLoadIdentity();
    // set the view to a 2D view
    gl.glOrtho(-400, 400, -300, 300, 0, 1);

    // switch to the model view matrix
    gl.glMatrixMode(GL2.GL_MODELVIEW);
    // initialize the matrix
    gl.glLoadIdentity();

    // set the clear color to white
    gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);

    // set the swap interval to as fast as possible
    gl.setSwapInterval(0);
  }