private void renderObject(GL2 gl, Camera camera, SceneObject obj) throws OpenGLException
	{
		/* If the object is not visible, we skip the rendition of it and all its children */
		if (!obj.isVisible()) {
			return;
		}
		
		/* Save matrix before applying this object's transformation. */
		gl.glPushMatrix();
		
		/* Get this object's transformation. */
		float scale = obj.getScale();
		Point3f position = obj.getPosition();
		AxisAngle4f orientation = new AxisAngle4f();
		orientation.set(obj.getOrientation());
		
		/* Apply this object's transformation. */
		gl.glTranslatef(position.x, position.y, position.z);
		gl.glRotatef(orientation.angle * 180.0f / (float)Math.PI, orientation.x, orientation.y, orientation.z);
		gl.glScalef(scale, scale, scale);
		
		/* Render this object as appropriate for its type. */
		if (obj instanceof Geometry)
		{
			for (Mesh mesh : ((Geometry)obj).getMeshes())
			{				
				if (mShowPenaltyForces){
					if(obj instanceof PhysicsGeometry){
						PhysicsGeometry physobj = (PhysicsGeometry) obj;
						gl.glPushMatrix();
						float sc = (float) physobj.getOriginParticle().getRadius();
						gl.glScalef(sc,sc,sc);
						renderMesh(gl, sphereMesh);
						gl.glPopMatrix();
						for (int i=0; i < physobj.getControlParticles().size() ; i++){
							Point3f cp  = physobj.getControlPoints().get(i);
							Particle p = physobj.getControlParticles().get(i);
							gl.glPushMatrix();
							gl.glTranslatef(cp.x, cp.y, cp.z);
							gl.glScaled(p.getRadius(), p.getRadius(), p.getRadius());
							renderMesh(gl, sphereMesh);
							gl.glPopMatrix();							
						}	
					}
				}
				//else {
				renderMesh(gl, mesh);
				//}

			}
		}
		else if (obj instanceof Light)
		{
			mLights.add((Light)obj);
		}
		
		/* Render this object's children. */
		for (SceneObject child : obj.getChildren())
		{
			renderObject(gl, camera, child);
		}
		
		/* Restore transformation matrix and check for errors. */
		gl.glPopMatrix();
		OpenGLException.checkOpenGLError(gl);
	}