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.
Page Index Toggle Pages: 1
Global Camera (Read 1005 times)
Global Camera
Apr 16th, 2008, 9:29pm
 
hey everyone,
i'm new to the community!

currently, i try to get deeper into 3D graphics with processing. of course, i have questions. i was wondering which CAMERA library/classes you would recommend. the built-in processing camera() method doesn't work to well for my purpose. i want to let the user paint objects in my sketch, but when the camera position is modified, it only changes the view on the last painted object.

what would you rather do?
1. get used to camera()
2. try to find some other library like sunflow
3. try to write some kind of frame-buffer where all the objects are stored, so i can later transform all of the in one step?

the third option seems a little bit too complicated as of right now. is there any GLOBAL CAMERA POSITION which changes the view on ALL the objects? (is there anything like that in sunflow?)

thanks in advance, i hope you can help me out!
yours, neon
Re: Global Camera
Reply #1 - Apr 16th, 2008, 9:35pm
 
I think you misunderstand part of how processing works. Once you've drawn something, it's drawn, and no amount of changing any form of camera will change it.

You'll have to store and re-draw all object when you change any camera settings, no matter if you use the built in camera) functions or any of the camera libraries.

Re: Global Camera
Reply #2 - Apr 16th, 2008, 9:43pm
 
thanks for the quick reply!
and how would you do that? what kind of array can i use to store all the objects and then redraw them?

is there any tutorial on this? i guess this is needed very often...

oh, and how can i import sunflow? where do i have to copy the .jar files?
Re: Global Camera
Reply #3 - Apr 16th, 2008, 11:48pm
 
It depends entirely on what kind of objects you're drawing.. if it's cubes for instance, you could create a set of arrays for the x/y/z coordinates, and then store the positions in there, to be drawn. If it's more complex shapes, then I'd write a custom class and keep an array of objects of your new class, which you can then add to and draw from.
Re: Global Camera
Reply #4 - Apr 17th, 2008, 10:13am
 
1) sounds like a good idea. is it necessary to make a point class AND a shape class? (the shape is definded by 6 points).

2) sunflow is super-slow on my powerbook. it takes one minute to render one frame. is this for real-time or just for rendering?
Re: Global Camera
Reply #5 - Apr 17th, 2008, 12:23pm
 
You could just make a shape class with a bunch of floats to store all the points, but making a point class woudl let you later on make a shape class that uses a different number of points.

Sunflow is for final rendering, it's definately not intended for real-time use.
Re: Global Camera
Reply #6 - Apr 17th, 2008, 5:46pm
 
thanks JohnG for your help. so how do you use sunflow? because i need realtime graphics with the render-this-frame option. can i change the renderer during runtime?
Re: Global Camera
Reply #7 - Apr 17th, 2008, 11:41pm
 
You can't change the renderer during runtime.  Don't use Sunflow unless you want to pre-render something. It's fairly slow because it calculates stuff like global illumination which is computationally expensive. If you want to do something in real-time use P3D or OPENGL instead.

If you'd like more control over the camera you might want to check out OCD camera.

If you create a custom class for shapes or objects you don't need to create a separate class to store it's position, it should be part of the same class.  You should construct your class so that it takes x/y/z coordinates as arguments, that way you can move it around.  If you're creating multiple objects create an array using that class, as John stated previously.  hope that helps.

peace.
Page Index Toggle Pages: 1