Hi,
I have same probrem on WindowsNT / OpenGL. Regardless of setting,
It looks that View.PHYSICAL_WORLD is always applied.
Here is my test code. Can anyone give me an advice?
If you can only test this in your environment, it's
still useful because I can know whether it is caused
by my code itself or not...
Thanks.
Tomohiro
----from here----
package viewTest;
import java.awt.*;
import java.awt.event.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.geometry.*;
public class FrameMain extends Frame {
Canvas3D theCanvas;
View theView;
void createEverything(int policy) {
// create Universe and Locale
VirtualUniverse theUniverse = new VirtualUniverse();
Locale theLocale = new Locale(theUniverse);
// create View
PhysicalBody body = new PhysicalBody();
PhysicalEnvironment environment = new PhysicalEnvironment();
theView = new View();
theView.setPhysicalBody(body);
theView.setPhysicalEnvironment(environment);
theView.setWindowResizePolicy(policy);
// create VeiwPlatform
ViewPlatform theViewPlatform = new ViewPlatform();
Transform3D t = new Transform3D();
t.set(new Vector3f(0.0f, 0.0f, 5.0f));
TransformGroup theViewTrans = new TransformGroup(t);
theViewTrans.addChild(theViewPlatform);
BranchGroup vpRoot = new BranchGroup();
vpRoot.addChild(theViewTrans);
// attach ViewPlatform to Locale
theLocale.addBranchGraph(vpRoot);
// create a simple scene
ColorCube cube = new ColorCube();
TransformGroup cubeTrans = new TransformGroup();
cubeTrans.addChild(cube);
BranchGroup sceneRoot = new BranchGroup();
sceneRoot.addChild(cubeTrans);
theLocale.addBranchGraph(sceneRoot);
// finally, attach view to canvas and viewplatform
theView.addCanvas3D(theCanvas);
theView.attachViewPlatform(theViewPlatform);
}
public void windowClosingX() {
hide();
System.exit(0);
}
public void initFrame() {
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
windowClosingX();
}
});
theCanvas = new Canvas3D(null);
add(theCanvas, BorderLayout.CENTER);
}
public void initWorld(int policy) {
createEverything(policy);
System.out.println("resize policy :" +
(theView.getWindowResizePolicy() == View.VIRTUAL_WORLD ?
"VIRTUAL" : "PHYSICAL"));
}
public FrameMain(int policy) {
super();
initFrame();
initWorld(policy);
}
public static void main(String[] args) {
int policy = View.VIRTUAL_WORLD;
if (args.length == 1) {
if (args[0].equalsIgnoreCase("virtual")) {
policy = View.VIRTUAL_WORLD;
}
else if (args[0].equalsIgnoreCase("physical")) {
policy = View.PHYSICAL_WORLD;
}
else {
System.err.println("unknown policy.");
System.exit(1);
}
}
FrameMain frameMain1 = new FrameMain(policy);
frameMain1.setSize(200, 200);
frameMain1.show();
}
}
----till here----
At 07:44PM 99/01/14 -0800, Price, Eric wrote:
> For what it's worth, the command works for me (i.e. does what the manual
> says it will do.) I do it before I attach the view branch to the locale, and
> before I attach the locale to the universe.
>
> Eric
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 14, 1999 8:55 AM
> To: [EMAIL PROTECTED]
> Subject: [java3d] View.setWindowResizePolicy implemented?
>
>
> Hello Everyone,
>
> I am trying to use View.setWindowResizePolicy( View.VIRTUAL_WORLD) and it
> doesn't seem to have any effect. This is under Windows NT/OpenGL. I want
> the
> size of the scene, view platform geometry, etc. to stay the same when the
> window is enlarged so that more or less of the virtual world is revealed.
> I've tried setting it to both VIRTUAL_WORLD and PHYSICAL_WORLD and discern
> any
> difference between the two. Does anyone know if this currently implemented
>
> for my platform?
>
> Thanks,
> -Gary
>
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
>
>
/* written by Koike,T. */
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/