We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I need to create arbitrary clipping planes to clip PShapes. Similar to this http://www.java-tips.org/other-api-tips/jogl/demonstration-of-arbitrary-clipping-planes.html. Is it possible? Thank you
Answers
Hello, You can use the perspective() method: http://processing.org/reference/perspective_.html
i'm not sure perspective() will work. it does allow you to specify front and back planes, but not arbitrary clipping planes...
Thanks koogs, you're right. I read the question too fast.
Interesting... :-?
Thanks for the comments. I think it can be done like this
The question is now if we could rotate the camera and look inside of the trimmed sphere.
have you tried peasycam?
This is the working example of clipping two opengl planes. It does not work with Processing 2.1, because of an error in gl = pgl.beginPGL().gl.getGL2(). Works fine in 2.0.3, so there is some change in 2.1 that i did not see documented in the opengl examples. Now I have to figure how to make this work for an imported obj model.
import processing.opengl.PGraphicsOpenGL; import javax.media.opengl.GL2; import peasy.*;
PGraphicsOpenGL pgl; GL2 gl; PeasyCam cam;
public void setup() {
One issue in Processing 2.1 occurs with that code because the codebase has altered slightly. You can no longer use that command to get the GL2 object.
So this has changed in Processing 2.1, which I was able to ascertain from the updated Processing Javadoc. Now, PJOGL is a new class that uses the functionality to get the GL2 object, and the PJOGL class extends from the PGL class
To correct this, you need to update how you get the GL2 object:
That will, at least, fix your OpenGL issues in Processing 2.1. I am unclear if there is a better method that is backwards-compatible, however.
Thank you.