Situate a TransformGroup inmediatly after branchgroup and the rest of the
scenegraph after it.
in this way:
BG
|
TG < must be the rotation desired
|
Rest
I hope that helps you
----- Original Message -----
From: "SUBSCRIBE JAVA3D-INTEREST Anonymous" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 30, 2001 2:22 PM
Subject: [JAVA3D] rotate canvas3D (part 3)
> Hi,
>
> Sorry to ask again the same question, but I didn't found the solution yet
: I'd like to rotate the canvas3D at 90 degrees, so I tryed two things :
>
> - rotating the branchgroup for the objects and the camera : it doesn't
work, I don't know why and I think it is not the good way
>
> - use postSwap and postRender methods, it does not work too, so I hope
that someone can explain me why :
>
> Here is the code :
> ------------------
>
> class MyCanvas3D
> extends Canvas3D
> {
> J3DGraphics2D g2Plan = null;
>
> public MyCanvas3D(GraphicsConfiguration graphicsConfiguration)
> {
> super(graphicsConfiguration, false);
> }
>
> public void postRender()
> {
> super.postRender();
>
> Rectangle2D shape =
> new Rectangle2D.Double((getWidth() - 70.0)/2.0,
(getHeight() - 70.0)/2.0, 70.0, 70.0);
> if (g2Plan == null)
> {
> g2Plan = getGraphics2D();
> }
> g2Plan.draw(shape);
> g2Plan.setComposite(AlphaComposite.Src);
> g2Plan.flush(true);
> }
>
> /*
> public void postRender()
> {
> super.postRender();
>
> if (g2Plan == null)
> {
> g2Plan = this.getGraphics2D();
> g2Plan.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
> RenderingHints.VALUE_ANTIALIAS_ON);
> }
>
> g2Plan.rotate(Math.PI/4, 600D, 600D);
>
> g2Plan.setComposite(AlphaComposite.Src);
> g2Plan.flush(true);
> }
> */
> }
>
>
> The rectangle is well drawn but if I use the other postRender method,
nothing happens !!!
>
> Where is my mistake ?
>
> Thanks
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".