@Override
  public void display(GLAutoDrawable glad) {
    System.out.println("display");

    GL3 gl3 = glad.getGL().getGL3();

    gl3.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
    gl3.glClear(GL3.GL_COLOR_BUFFER_BIT);

    programObject.bind(gl3);
    {
      programObject.setUniform(gl3, "offset", new float[] {0.5f, 0.5f}, 2);

      gl3.glBindBuffer(GL3.GL_ARRAY_BUFFER, vertexBufferObject[0]);

      gl3.glEnableVertexAttribArray(0);
      gl3.glEnableVertexAttribArray(1);
      {
        gl3.glVertexAttribPointer(0, 4, GL3.GL_FLOAT, false, 0, 0);
        gl3.glVertexAttribPointer(1, 4, GL3.GL_FLOAT, false, 0, 36 * 4 * 4);

        gl3.glDrawArrays(GL3.GL_TRIANGLES, 0, 36);
      }
      gl3.glDisableVertexAttribArray(0);
      gl3.glDisableVertexAttribArray(1);
    }
    programObject.unbind(gl3);

    glad.swapBuffers();
  }
  /** This method is called at the beginning of each frame, i.e., before scene drawing starts. */
  private void beginFrame() {
    // Set the active shader as default for this frame
    gl.glUseProgram(activeShaderID);

    // Clear color and depth buffer for the new frame
    gl.glClear(GL3.GL_COLOR_BUFFER_BIT);
    gl.glClear(GL3.GL_DEPTH_BUFFER_BIT);
  }
Beispiel #3
0
 @Override
 public void display(GLAutoDrawable drawable) {
   GL3 gl = drawable.getGL().getGL3();
   gl.glClear(GL3.GL_COLOR_BUFFER_BIT | GL3.GL_DEPTH_BUFFER_BIT);
   // ------  Kamera-System  -------
   loadIdentity(gl);
   setColor(0, 0, 0);
   setShadingLevel(gl, 0);
   setCameraSystem(gl, dCam, elevation, azimut);
   drawAxis(gl, 50, 50, 50);
   setColor(Color.RED);
   t.add(new Vec3(sat1.x[0], sat1.x[1], sat1.x[2]));
   sat1.draw(gl);
   setColor(Color.BLUE);
   t.draw(this, gl);
   sat1.move(dt);
 }