Example #1
0
  /** OpenGL drawing function */
  @Override
  public void display(GLAutoDrawable auto_drawable) {
    // get the GL context
    final GL gl = auto_drawable.getGL();
    // clear the buffers
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    // load the identity matrix
    gl.glLoadIdentity();

    // translations so we can see drawing
    gl.glTranslatef(0, 0, -0.7f);

    if (LoadTexturePosted == true) {
      if (LoadGuessModelPosted == null) System.err.println("ERROR: LoadGuessModelPosted is null!");
      current_Texture =
          AnimalTexture.findAnimalTexture(Animal_Tex_Array, LoadGuessModelPosted.getAnimalName());
      LoadTexturePosted = false;
    }

    // if the current texture is null, load the question texture
    if (current_Texture == null) question_Texture.bind();
    else current_Texture.bind();

    // draw the cube
    gl.glPushMatrix();
    gl.glRotatef(yrotate, 0.0f, 1.0f, 0.0f);
    drawOpenCube(gl);
    gl.glPopMatrix();

    // increase rotation
    yrotate += 0.05;
  }
Example #2
0
 /**
  * Posts (sets a boolean to true) a load call into the drawing function We need to post it because
  * we don't have an OpenGL context in this call and need it to properly perform this function
  * Posting it allows us to have runtime flexibility. Pass null to have it load the default
  * (question_Texture)
  *
  * @param load
  */
 public void LoadGuessTexture(GuessModel load) {
   System.out.println(
       "GuessModel name: " + load.getAnimalName() + " Path: " + load.getpathToTexture());
   LoadTexturePosted = true;
   LoadGuessModelPosted = load;
 }