As I have not worked with Animated GIFs, I don't know of any problems you may encounter.
 
To create MPEG files, you can try using mpeg_encode (the free Berkeley MPEG-1 encoder), which is what I have done. However, I have not been able to encode MPEGs from JPEGs because of incompatibilites between the JPEG libraries of the sun encoder and mpeg_encode. In addition, if your scene is going to be changing rapidly -- a lot of fast motion, etc. -- then MPEG might not be the best solution due to its encoding algorithm.
 
Another option is to try the Java Media Framework, which I believe can create AVI and Quicktime movie files (possibly others). But, I have not yet used it, so cannot offer any insight.
 
Sean
 

-----Original Message-----
From: Raghavendra R [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 01, 2002 4:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Change background color of Canvas3D

Hi Sean,

I was able to get hold of a couple of GIF encoders (Acme, Neuquant). I have already extended the Canvas3D class and overridden the postSwap method as part of JPEG encoding. I will try these and will post a query if i run into any problems. Also, are there any clauses in encoding in Animated GIF format? Basically, i wanted to export the canvas frames in Animated GIF or any movie format like AVI / MPEG.

Thanks
Raghav

Sean Sylvis wrote:
[EMAIL PROTECTED] type="cite">
for the gif encoder, just do a google search for 'java gif encoder'. i think there is a list somewhere of java decoders/encoders for different image formats.
 
to create animated gifs, you can simply write a gif file each time the postSwap() method is called (you should extend the Canvas3D class and subclass the postSwap() method to write the canvas image. for a more involved answer, this has been discussed on the list before, so you should search the archives for previous postings. and let me know if you need more direction.
 
sean
 
-----Original Message-----
From: Raghavendra R [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 4:35 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Change background color of Canvas3D

Hi Sean / David,

Thanks for the solution. It worked very well. I also need to save the Canvas3D frames in Animated GIF format. Are there any good "Animated GIF encoders" that i can use.

Thanks once again
Raghav

Sean Sylvis wrote:
[EMAIL PROTECTED] type="cite">
After you first create the Canvas3D...

// Set background to pColor
Background vBackground = new Background(new Color3f(pColor));
vCanvas.getGraphicsContext3D().setBackground(vBackground);


And in the preRender method of your extended Canvas3D...

// Clear background to background color
super.getGraphicsContext3D().clear();

Sean


-----Original Message-----
From: Raghavendra R [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 30, 2002 5:56 AM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Change background color of Canvas3D


Hi,


I am calling the repaint method from a method "PrintImage". I
have used
the piece of code in "http://www.j3d.org/faq/capturing.html". I tried
setting the Canvas background color and also tried to get Graphics2D
from the BufferedImage and set the color etc, but still the background
remains black.

PrintImage()
{
myCanvas.repaint()
}

RenderCanvas extends Canvas3D
{
postSwap()
{
GraphicsContext3D ctx = getGraphicsContext3D();
Rectangle rect = getBounds() ;

Raster ras = new Raster(new Point3f(-1.0f,-1.0f,-1.0f),
Raster.RASTER_COLOR, 0, 0, rect.width,
rect.height, new
ImageComponent2D(ImageComponent.FORMAT_RGB,
new BufferedImage(rect.width, rect.height,
BufferedImage.TYPE_INT_RGB)), null);

BufferedImage img = ras.getImage().getImage();

try
{
FileOutputStream out =
new
FileOutputStream("images/Capture"+postSwapCount_+".jpg");
JPEGImageEncoder encoder =
JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param =
encoder.getDefaultJPEGEncodeParam(img);
param.setQuality(0.9f, false);
encoder.setJPEGEncodeParam(param);
encoder.encode(img);
writeJPEG = false;
out.close();
}
catch (IOException e)
{


}
}
}

Shouldn't i be setting the background color of the Canvas3D before
calling the repaint method or can we swap the colors in the
BufferedImage?

Thanks
Raghav


David Bourgais wrote:

Hi !

To change your background color, you sohould use this :

float coul1, coul2, coul3; /*In french, coul for couleur (couleur =
color in perfect english)*/
Background bg = new Background(coul1, coul2, coul3);
bg.setCapability(bg.ALLOW_COLOR_READ);
bg.setCapability(bg.ALLOW_COLOR_WRITE);
bg.setApplicationBounds(/*your BoundingSphere*/);
YourScene.addChild(bg);
//Changing the background color
float a, b, c;
bg.setColor(a,b,c);

I hope that it will help you.

David Bourgais


==============================================================
=============
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".


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".




Reply via email to