FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   Camera Screen align
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Camera Screen align  (Read 421 times)
Andre_Michelle

WWW
Camera Screen align
« on: Jul 29th, 2004, 6:02pm »

hi,
 
 
i hope its ok, that I'm posting nearly daily.
I'm currently working closer with processing and every step can be a question )
 
ok. I have a 3D Camera for a tetris clone, that draws a centered cylinder, where the tile are mapped.
 
Now I want to display the nextBlock, like in the oldschool version. How can I set the center of 2D Projection to maybe TOP/LEFT ?
 
If I translate the preview 3d boxes in 3d, they are distort of course.
 
Any suggestions ?
 
bsr

WWW Email
Re: Camera Screen align
« Reply #1 on: Jul 29th, 2004, 9:06pm »

i'm not entirely sure but i think you can use push() and pop() for this: http://processing.org/reference/push_.html
 
i'll leave it to a proper programmer to give you an answer though!
 

http://hippocamp.net
Andre_Michelle

WWW
Re: Camera Screen align
« Reply #2 on: Jul 30th, 2004, 11:56am »

Yes i've tried it, but its still confusing me.
 
Something like:
Code:

  translate( 100 , 150 ); // should translate in 2d ? (does not work)
  beginCamera();
  push();
  perspective(fovy, aspect, Znear, Zfar);
  translate( 0 , path * -150  , -distance );
  rotateX( path * PI / 5 );
  rotateY( ay );
  endCamera();
  pop();

 
mmh. need more input...
 
narain


Re: Camera Screen align
« Reply #3 on: Jul 30th, 2004, 4:18pm »

I've never seen the camera functions mixed with push/pop, actually. Not sure if it can be done.
 
But assuming it can, the order of calls may be the problem. push() should be done before anything you eventually want to discard, which probably includes beginCamera().
 
I think this may work:
Code:
push();
beginCamera();
// ... etc ...
endCamera();
 
// draw the 3D stuff here
 
pop();
 
// draw the 2D stuff

 
Say, you might even be able to discard the push()/pop() altogether, if you draw the 2D stuff before calling beginCamera(). I don't know if this will work, but it's an idea.
 
Code:
// draw 2D stuff
 
beginCamera();
// ... etc ...
endCamera()
 
//draw 3D stuff
 
Andre_Michelle

WWW
Re: Camera Screen align
« Reply #4 on: Jul 30th, 2004, 5:13pm »

Perhaps, its not clear, what I want.
 
The Camera has its screen center at the applet window center.
 
I just want to move the projectionplane(!) to another position on the 2d screen.
 
hope its clear now. I don't get the solution.
 
narain


Re: Camera Screen align
« Reply #5 on: Jul 30th, 2004, 5:32pm »

Oh, that's what you want to do. Sorry, I didn't get you properly that time.
 
Hmm... One solution could be to draw the block in the center of a new (small) image, than draw the image in the place you want. See this thread: http://processing.org/discourse/yabb/board_Syntax_action_displa_y_num_1080671926.html
 
I'm very doubtful this actually will work with 3D, but it's worth a try...
 
Update: I just tried BGraphics, and it doesn't seem to be working for me. I've posted the problem to the above thread, hopefully one of the Processing luminaries will come along and sort it out.
« Last Edit: Jul 30th, 2004, 5:42pm by narain »  
Pages: 1 

« Previous topic | Next topic »