Skip to main content

RESIZE

8 replies [Last post]
muralithefun
Offline
Joined: 2010-09-04

Hi All,
I am a beginner to java3d.i'm doing a simple application where i placed my camera(viewingplatform) to a certain position to view the object(Cube).The problem is, when i resize the window the object is scaled accordingly and set in the view,but i need the shape to remain in the same place when it is resized.Is there any possible way?Do i have to set any view policies?Pls i need it urgently.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
muralithefun
Offline
Joined: 2010-09-04

Still it has not been answered....

darwinjob
Offline
Joined: 2004-11-16

http://download.java.net/media/java3d/javadoc/1.5.2/javax/media/j3d/View...

# Window resize policy - specifies how Java 3D modifies the view when users resize windows. When users resize or move windows, Java 3D can choose to think of the window as attached either to the physical world or to the virtual world. The window resize policy allows an application to specify how the view model will handle resizing requests. There are two window resize policies:

* VIRTUAL_WORLD - [b]implies that the original image remains the same size on the screen[/b] but the user sees more or less of the virtual world depending on whether the window grew or shrank in size.

* PHYSICAL_WORLD - implies that the original image continues to fill the window in the same way using more or less pixels depending on whether the window grew or shrank in size.

Philip Whitehouse

You aren't particularly clear:

A) lf you want the whole canvas to remain the same size use canvas.setMaximumSize

B) if you want the cube to stay the same size you should define a size in and then use a transform to scale it relative to the window so it looks the same size. This should be the last transform you do and be applied to the top branch. Essentially its a world - view scale transform.

Philip Whitehouse

On 4 Sep 2010, at 19:04, java3d-interest@javadesktop.org wrote:

> Hi All,
> I am a beginner to java3d.i'm doing a simple application where i placed my camera(viewingplatform) to a certain position to view the object(Cube).The problem is, when i resize the window the object is scaled accordingly and set in the view,but i need the shape to remain in the same place when it is resized.Is there any possible way?Do i have to set any view policies?Pls i need it urgently.
> [Message sent by forum member 'muralithefun']
>
> http://forums.java.net/jive/thread.jspa?messageID=481887
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
For additional commands, e-mail: interest-help@java3d.dev.java.net

muralithefun
Offline
Joined: 2010-09-04

thanks for answering but what i need is...let's see an example...initially i am placing the cube at the origin relative to the virtual world coordinate system....my problem is say when a user resizes the window or minimize the window, the position of the cube changes.I need it to be there without any change in position even when i resize the window.

Philip Whitehouse

Yes, what you need is option B:

Something like:

BranchGroup objRoot = new BranchGroup();

// rotate object has composited transformation matrix
Transform3D scale = new Transform3D();
scale.setScale(canvas.getSize().height()/defaultcanvasheight);

TransformGroup objScale = new TransformGroup(scale);

objRoot.addChild(objRotate);
objRotate.addChild(cube);
// Let Java 3D perform optimizations on this scene graph.

This assumes your canvas is a fixed ratio - you can still do it if not but need to think more about it - or your cube will not always appear as a cube!

Philip Whitehouse
Undegraduate
BSc Computer Science
Loughborough University

On 4 Sep 2010, at 20:41, java3d-interest@javadesktop.org wrote:

> thanks for answering but what i need is...let's see an example...initially i am placing the cube at the origin relative to the virtual world coordinate system....my problem is say when a user resizes the window or minimize the window, the position of the cube changes.I need it to be there without any change in position even when i resize the window.
> [Message sent by forum member 'muralithefun']
>
> http://forums.java.net/jive/thread.jspa?messageID=481894
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net
> For additional commands, e-mail: interest-help@java3d.dev.java.net
>
>
[att1.html]

muralithefun
Offline
Joined: 2010-09-04

you are saying about changing the scale right....but i want the position of the cube to remain same even when it is resized. For example,the location of the cube is 0,0 in screen coordinates means even after it is resized it should be in 0,0 without any scaling.

lyfox
Offline
Joined: 2010-08-17

Then you just take your canvas screen coordinates and translate the cube according to how they change. But if I were you, I'd rather build a full-screen application or forbid the window resizing.

Good luck.

muralithefun
Offline
Joined: 2010-09-04

what you are saying can be done but in my application i have too many models.So,i can't translate for every model.Can anyone explain me about the view policies?I think that can help my problem...and one more thing without using the ortho can we set the viewing volume exactly.