I tried it and the other, but it does not work, could you run this code on your machine, that I know, that my configuration is OK?
Thank for the time, you are spending for my problem.
Bj�rn
Try changing
test.u = new SimpleUniverse();
to
test.u = new SimpleUniverse(c);
And take out your view lines...
I assume this is the same thing, but its how I got it to work..
Kev
Hi Kevin,
thank you for your fast reply, but it still not work
Looking at the code for model2sprite (http://model2sprite.dev.java.net) three things might be worth trying:
1) Make sure rendering your scene to a normal canvas actually shows something.
This works , I use the HelloUniverse Demo with a cube3d and a normal canvas shows the Image without problems.
2) Try using c.getOffscreenBuffer().getImage() after the rendering instead of relying on you're original image.
This was not successful, but this the same like using the reference of the BufferedImage I used to create the Buffer.
There was Nothing after 100 renderings3) Try causing the scene to render a few times (c.renderOffScreenBuffer(),c.waitForOffScreenRendering()) before using the image, since some behaviors need a few frames to get going.
Shit !!!!!!!!
Homepage!I'm not sure what you're doing with the View.addCanvas3D() thing, its not quite the same as how I did it. If you're interested it might be worth checking out the org/newdawn/model2sprite/OffscreenCanvas3D.java from CVS on the java.net site above.
Kev
Hello Java3d Fans,
I am a Java3d beginner and want to programm an servlet, which create an JPEG of a JAVA3d-Scene.
I wrote a test class using Canvas 3d in offscreen mode, but all I get is an empty Image. What did I wrong? I hope you can help me to fix this ...
Thank you
Here is the program:
[...]
public class Test {
private SimpleUniverse u;
public Test(){}
public BranchGroup createSceneGraph(){ [...] return objRoot; }
public static void main(String[] args) { Test test = new Test(); GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration(); Canvas3D c = new Canvas3D(config,true); Screen3D sOff = c.getScreen3D();
c.getScreen3D().setSize(100,100); c.getScreen3D().setPhysicalScreenWidth( (0.0254/90.0)* 100); c.getScreen3D().setPhysicalScreenHeight((0.0254/90.0)* 100);
BranchGroup scene = test.createSceneGraph(); test.u = new SimpleUniverse(); test.u.getViewingPlatform().setNominalViewingTransform(); test.u.addBranchGraph(scene);
View v = test.u.getViewer().getView(); v.addCanvas3D(c);
BufferedImage bImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); ImageComponent2D buffer = new ImageComponent2D(ImageComponent.FORMAT_RGB, bImage); buffer.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
c.setOffScreenBuffer(buffer); c.renderOffScreenBuffer(); c.waitForOffScreenRendering();
try { DataOutputStream output = new DataOutputStream(new FileOutputStream("C:\\borstels-offscreen-test.jpg")); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(output); encoder.encode(bImage); output.flush(); output.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Thank you for helping
Bj�rn
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte l�cheln! Fotogalerie online mit GMX ohne eigene
=========================================================================== 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".
-- Jose UML - http://www.newdawnsoftware.com/jose Warlock - http://www.cokeandcode.com/warlock
=========================================================================== 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".
-- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte l�cheln! Fotogalerie online mit GMX ohne eigene Homepage!
=========================================================================== 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".
-- Jose UML - http://www.newdawnsoftware.com/jose Warlock - http://www.cokeandcode.com/warlock
=========================================================================== 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".
