示例#1
0
  @Override
  public void render() {
    int width = App.getScreenWidth();
    int height = App.getScreenHeight();

    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    gluOrtho2D(0, width, 0, height);
    glScalef(1, -1, 1);
    glTranslatef(0, -height, 0);
    glMatrixMode(GL_MODELVIEW);
    glDisable(GL_DEPTH_TEST);
    // Draw background
    glBegin(GL_QUADS);
    {
      if (backgroundColor != null) GeneralUtils.glColorShortcut(backgroundColor);

      glVertex2f(0, 0);
      glVertex2f(0, height);
      glVertex2f(width, height);
      glVertex2f(width, 0);
    }
    glEnd();

    for (GuiButton b : buttons) {
      b.render();
      // System.out.println(b.isMouseOver());

    }

    // I don't want to set the same opengl settings for every button.
    // We can reduce a least a tiny bit of overhead by doing it in one go
    font.renderBegin();
    for (GuiButton b : buttons) {
      b.renderText();
    }
    font.renderEnd();

    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_DEPTH_TEST);
  }
示例#2
0
 @Override
 public void gluOrtho2D(GL10 gl, float left, float right, float bottom, float top) {
   org.lwjgl.util.glu.GLU.gluOrtho2D(left, right, bottom, top);
 }