@Override
  public final void ppBegin(final GL gl) {
    if (null == sp) {
      throw new IllegalStateException("Not initialized");
    }
    if (0 == frameStart) {
      throw new IllegalStateException("beginFrame not called");
    }
    final GL2ES2 gl2es2 = gl.getGL2ES2();

    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    gl.glActiveTexture(GL.GL_TEXTURE0 + getTextureUnit());

    gl2es2.glDisable(GL.GL_CULL_FACE);
    gl2es2.glDisable(GL.GL_DEPTH_TEST);
    gl2es2.glDisable(GL.GL_BLEND);

    if (!gl2es2.isGLcore()) {
      gl2es2.glEnable(GL.GL_TEXTURE_2D);
    }

    sp.useProgram(gl2es2, true);

    gl2es2.glUniform(texUnit0);
  }
  protected static void render(GL pGL, int width, int height) {
    pGL.glClear(GL.GL_COLOR_BUFFER_BIT);

    // draw a triangle filling the window
    pGL.getGL2().glLoadIdentity();
    pGL.getGL2().glBegin(GL.GL_TRIANGLES);
    pGL.getGL2().glColor3f(r, 0, 0);
    pGL.getGL2().glVertex2f(0, 0);
    pGL.getGL2().glColor3f(0, g, 0);
    pGL.getGL2().glVertex2f(width, 0);
    pGL.getGL2().glColor3f(0, 0, b);
    pGL.getGL2().glVertex2f(width / 2, height);
    pGL.getGL2().glEnd();
  }
Exemple #3
0
 public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
   GL gl = drawable.getGL();
   gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
   gl.glViewport(0, 0, width, height);
   return;
 }