java – face that removes all faces that can not be seen

I'm working on a simple 3D game with the Processing Java environment. I want to optimize my code so that I can draw many "objects" (the world is made up of many differently shaped objects living in the volume of a cube) without the frame rate dropping. How can I tell which faces are invisible and stop drawing? I tried this code:

pgl = (PJOGL) beginPGL ();
gl = pgl.gl.getGL2ES2 ();
gl.glEnable (GL.GL_CULL_FACE);
gl.glCullFace (GL.GL_BACK);

that does cutback, but it's not all I want. I want to stop rendering any Face that the camera can not see, eg. B. inner faces etc.

The code used to draw the objects (just a simple cube for testing) is as follows:

                noFill ();
noStroke ();
noSmooth ();
to press();
Lighting();
translate (this.x * this.size, this.y * this.size, this.z * this.size);
beginShape (QUADS);
Texture (this.texture_image);
Vertex (-this size / 2, -this size / 2, this size / 2, 0, 0);
Vertex (this.size / 2, -this.size / 2, this.Size / 2, this.Size / 2, 0);
Vertex (this.size / 2, this.size / 2, this.Size / 2, this.Size / 2, this.Size / 2);
Vertex (-this.size / 2, this.size / 2, this.Size / 2, 0, this.Size / 2);

// -Z "back" face
Vertex (this size / 2, -this size / 2, -this size / 2, 0, 0);
Vertex (-this size / 2, -this size / 2, -this size / 2, this size / 2, 0);
Vertex (-this.size / 2, this.Size / 2, -this.size / 2, this.Size / 2, this.Size / 2);
Vertex (this.size / 2, this.Size / 2, -this size / 2, 0, this.Size / 2);

// + Y "lower" face
Vertex (-this.size / 2, this.size / 2, this.Size / 2, 0, 0);
Vertex (this.size / 2, this.size / 2, this.Size / 2, this.Size / 2, 0);
Vertex (this.size / 2, this.Size / 2, -this.size / 2, this.Size / 2, this.Size / 2);
Vertex (-this.size / 2, this.Size / 2, -this.size / 2, 0, this.Size / 2);

// -Y "upper" face
Vertex (-this size / 2, -this size / 2, -this size / 2, 0, 0);
Vertex (this.Size / 2, -this.Size / 2, -this Size / 2, this.Size / 2, 0);
Vertex (this.size / 2, -this.size / 2, this.Size / 2, this.Size / 2, this.Size / 2);
Vertex (-this size / 2, -this size / 2, this size / 2, 0, this size / 2);

// + X "right" face
Vertex (this.size / 2, -this.size / 2, this.Size / 2, 0, 0);
Vertex (this.Size / 2, -this.Size / 2, -this Size / 2, this.Size / 2, 0);
Vertex (this.size / 2, this.Size / 2, -this.size / 2, this.Size / 2, this.Size / 2);
vertex (this.size / 2, this.size / 2, this.size / 2, 0, this.size / 2);

// -X "left" face
Vertex (-this size / 2, -this size / 2, -this size / 2, 0, 0);
Vertex (-this size / 2, -this size / 2, this size / 2, this size / 2, 0);
Vertex (-this.size / 2, this.size / 2, this.Size / 2, this.Size / 2, this.size / 2);
Vertex (-this.size / 2, this.Size / 2, -this.size / 2, 0, this.Size / 2);

endShape ();
Pop();

Sorry for the long code.

Thank you in advance.