We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Problem with OCD Obsessive Camera Direction librar
Page Index Toggle Pages: 1
Problem with OCD Obsessive Camera Direction librar (Read 1727 times)
Problem with OCD Obsessive Camera Direction librar
Sep 9th, 2007, 6:45pm
 
Hello, thanks to Kristian Linn Damkjer for the OCD library
I'm having a problem with all the examples from http://www.cise.ufl.edu/~kdamkjer/processing/libraries/ocd/
Processing 0125 (with jre 1.6 installed) gives me this error

java.lang.IncompatibleClassChangeError
at damkjer.ocd.Camera.atan2(Camera.java:413)

anybody knows how can I correct this?
thanks
Re: Problem with OCD Obsessive Camera Direction li
Reply #1 - Sep 9th, 2007, 8:29pm
 
you'll find the answer if you click the bright red "Read before downloading 0116 and 0125!" link on the download page. Wink
Re: Problem with OCD Obsessive Camera Direction li
Reply #2 - Sep 9th, 2007, 11:49pm
 
There is a workaround until a new export makes an appearance. In the .zip file that you download the jar in is a .java file. Drop this into your sketch so that it is another tab in the sketch.

Comment out this line at the top of the .java file
Code:
package damkjer.ocd; // delete this line 


change the name of the camera class to be
Code:
 public class OCDCamera {  


and change the name of the constructors of the class. From
Code:
public Camera(PApplet parent)  


to
Code:
public OCDCamera(PApplet parent)  


There are five of these. Make sure to change them all.

ok last thing. Remove the import ocd line from the top of your sketch.
Code:
//import damkjer.ocd.*; 


and change these
Code:
Camera camera1;
camera1 = new Camera(this, 200, -250, 300);

to these
Code:
OCDCamera camera1;  // pulls in the new renamed class
camera1 = new OCDCamera(this, 200, -250, 300); // activates the renamed constructor


All this hack does is rename the class and constructors to stop the naming conflict. One day there will be a recompile of the library to fix the naming issues. Until then I hope this helps you out.
Re: Problem with OCD Obsessive Camera Direction li
Reply #3 - Sep 10th, 2007, 11:39pm
 
Thank you!
Re: Problem with OCD Obsessive Camera Direction li
Reply #4 - Sep 11th, 2007, 1:50am
 
Thanks again!
Now I've got a question about using the libary:
how could I do stuff on the screen (modify the matrix for 3D, draw things,...) and make this stuff not to be rendered by the camera created by OCD?
I'm trying to work with a camera and at the same time draw a GUI on top (this shouldn't be rendered by the camera)

I tried to do this:

// camera...
beginCamera();
camera.feed();
endCamera();

// GUI stuff...

where the method feed() contains the camera() call, this way it is inside beginCamera() and endCamera():
public void feed() {
     parent.perspective(fov, aspect, nearClip, farClip);
     parent.camera(cameraX, cameraY, cameraZ,
            targetX, targetY, targetZ,
            upX,     upY,     upZ);
}

but it doesn't work... the camera still modifies every thing...

Also tried with different PGraphics, but it goes slower and I can't say to the camera which PGraphics to use...
Re: Problem with OCD Obsessive Camera Direction li
Reply #5 - Sep 11th, 2007, 6:24am
 
Good question. Short answer. Not sure, I've never tried it.

Long answer. Here are three ideas

My first thought would be to render the HUD to an off screen PGraphic. Use a certain pixel value as transparent. Then draw the non transparent pixels over the top of the 3D scene using the PGraphic pixel[] at the end of the draw loop. Not too certain how fast that will be but it should work. (Maybe)

My second thought would be to keep the whole thing in one scene and to use the camera matrix to draw the HUD aligned to the camera.

Third option would be to use two cameras, one pointing to the 3d object and one pointing to the hud. In the draw loop swap from one camera to the other and make sure you clear the Z-buffer before you swap to the second camera. You can see how in this post.
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1188791482

hope that helps.
Re: Problem with OCD Obsessive Camera Direction li
Reply #6 - Oct 11th, 2008, 9:38pm
 
Hey, I realize this is a pretty old thread but I found a quick hack that seems to work for drawing GUI components on top of a 3D scene. Since OCD uses the processing camera() function the camera transformations are transfered to the GUI functions so that they render undesirably in 3D space.

Simply calling the basic camera() function after drawing the 3D scene resets the view and GUI elements render normally.

I'm running processing version 135 using openGL rendering along with the Interfascia and OCD libraries, and it seems to be working so far.
Page Index Toggle Pages: 1