freshwaterjoe
freshwaterjoe

Reputation: 101

glTranslate error in simple JOGL program

I am trying to create a simple JOGL program, and have run into a problem. I just imported all of the necessary packages into my class file, however now, every time I use the glTranslate function, it is being flagged red as an error, for example at the end of this block of code.

public void lab2a(GLAutoDrawable drawable) {
    GL gl = drawable.getGL();
    gl.glTranslatef(-1.0f, -1.0f, -6f);

    // Drawing first rectangle (blue)
    gl.glBegin(GL.GL_QUADS);
    gl.glColor3f(0f, 0f, 1f);   // sets color to blue
    gl.glVertex3f(-0.5f, 0.5f, 0.0f);   //Top left vertice
    gl.glVertex3f(0.5f, 0.5f, 0.0f);    //Top right vertice
    gl.glVertex3f(-0.5f, -0.5f, 0.0f);  //Bottom left vertice
    gl.glVertex3f(0.5f, -0.5f, 0.0f);   //Bottom right vertice
    gl.glEnd();
    gl.glTranslate(1.1f, 0f, 0f);

The flag reads: "cannot find symbol", and is present for each use of glTranslate I use. Does anybody have any idea how to fix this?

Upvotes: 0

Views: 121

Answers (1)

gouessej
gouessej

Reputation: 4125

Your source code is obsolete, it uses JOGL 1 whose maintenance was stopped in 2010.

Please switch to JOGL 2, go to jogamp.org. Replace GL.GL_QUADS by GL2.GL_QUADS, replace GL gl = drawable.getGL() by GL2 gl = drawable.getGL().getGL2(), etc... Look at the API documentation here.

Upvotes: 1

Related Questions