Hi Kelvin, Thanks for the reply. I was able to resolve this issue. Thanks for the invaluable hints regarding the Renderer / Scene graph updations. I was able to fix this by firstly changing the text color of the Shape3D/Texture2D entities (called from the main class) and then changing the background color of the Canvas3D (preRender) and in the same rendering loop, exporting the image to JPEG (postSwap).
However, the text color changes did not get reflected in the JPEG immediately after the scene graph updations nor in the first rendering loop but got reflected only after the second renderering loop was called. I was not able to understand this behavior. Also , i have not used behaviors to change the text color. Can you let me know any good references for the Renderer / Canvas3D / Scene graph which can throw more light on these features? Thanks Raghav Kelvin Chung wrote: > > > Raghavendra R wrote: > >> Hi, >> >> I have an issue with exporting Canvas3D as JPEG. I tried posting to >> the J3d mailing list and the J3d forum without much success. >> Basically, i have an application which renders a CAD graphics image >> on a Canvas3D. I have extended the Shape3D and used Texture2D for >> drawing text on the Canvas3D for legends / annotation etc. The >> Canvas3D contains a scenegraph of a CAD drawing. >> >> I need to change the color of the legend text at runtime while >> rendering the Canvas3D and exporting the image as a JPEG file. >> However, when i change the color of the text, it does not get >> reflected immediately and the JPEG image still contains the previous >> text color. The text color gets changed after the rendering is over. >> What could be wrong here? >> >> I have extended the Canvas3D where i am overriding the preRender, >> postRender and postSwap methods. I am changing the background color >> from another class and changing the text color from the postRender >> method after having set the writeJPEG flag and then calling repaint >> method for the Canvas3D. While setting the text color, i am detaching >> and adding the branchgroup containing the text objects. >> >> The text color gets changed after the control flows back to the >> calling function. How to ensure that the change in text color gets >> reflected in the JPEG image? Do the Renderer and Scenegraph updations >> take place parallely or with delays? >> > > If the code that you change text color is in behavior callback > than the change will take effect in the next rendering frame > cycle (not the current frame). As mention in the Behavior doc. > If you are using Canvas3D postRender() to capture the image the change > make in the same frame (either via AWT thread or behavior thread) will > appear in the next rendering cycle. So you may need to set a counter > to capture the image in postRenderer() the second time it is invoked > assme the counter is reset when text color change. Renderer and > scenegraph update are take place in parallel. > > > - Kelvin > ------------- > Java 3D Team > Sun Microsystems Inc. > > > > =========================================================================== 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".