@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); }
@Override public void display(GLAutoDrawable pDrawable) { if (error) { return; } countFps(); simpleMoveAnimator.updateState(); GL2 gl = pDrawable.getGL().getGL2(); // System.err.println("INIT GL IS: " + gl.getClass().getName()); GLU glu = new GLU(); lightRender.draw(gl); // _direction_ // gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, // this.lightPos, 0); // // Clear the drawing area // gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); // // // // // // Reset the current matrix to the "identity" // gl.glLoadIdentity(); // // gl.glMatrixMode(GL2.GL_MODELVIEW); // gl.glLoadIdentity(); // clear color and depth buffers gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); setCamera(gl, glu, simpleMoveAnimator); gl.glEnable(GL.GL_MULTISAMPLE); skyBox.draw(gl, simpleMoveAnimator.getPoint()); ground.draw(gl, simpleMoveAnimator.getPoint()); if (modelRender.isDebugging()) { axisLabels.draw(gl); floor.draw(gl); // drawTextInfo(gl, simpleMoveAnimator.info()); } renderJosm.draw(gl, simpleMoveAnimator); // selectionDrawUtil.draw(gl, objectSelectionListener, // simpleMoveAnimator); drawCompass(gl); // Flush all drawing operations to the graphics card gl.glFlush(); }