If all u do is tracking pointer coordinates and painting smth in the
current position, then u need to use double buffering to avoid flickering.
Only in Java3D 1.2 u can draw into the offscreen image. In earlier
versions u can't access the offscreen image. (The alternative is to
create your own offscreen image and draw both 3D scene and your
customized graphics into it, outputting it afterwards onto the
physical device, but this would drastically drop the performance).
Just in case u r not acquainted with double-buffering, below is a
brief summary of this technique.
1) offscreenImg = comp.createImage(width, height);
2) offscreenGraphics = offscreenImg.getGraphics();
3) override comp.update(Graphics g) method:
{
paint(g); // Default implementation fills the area with
// Background color first
}
4) overide comp.paint(Graphics g) method:
{
// Output to offscreen image
offscreenGraphics.????? // Draw whatever u want. In your case -
// drawImage
// Output to 'physical' device
g.drawImage(...// offscreenImg ...);
}
-----------------------
Basically that's all. In Java3D 1.2 version u already have offscreen
image created, so, just do all your custom output to it (not
necessarily in paint method, but u may also do it directly in MouseEvents handler, for
instance). This way u wouldn't have to override canvas3D.paint method.
Think this should help,
vladimir
PS: i never tried to do it myself in Java3D 1.2, but in theory this should
work just fine. Also, i guess u shouldn't override update method in
Java3D, because it must have been already overridden in Canvas3D
class. Just do your output to the offscreenImage, that's all.
-=V=-
>-------<=============>-------<
Join in Java community now!
http://JavaCafe.VirtualAve.net/
>-------<=============>-------<
In your previous letter u wrote:
--------------------------------
DdR> Hi everybody,
DdR> I'm trying to create a custom cursor in a Java 3D application. When the
DdR> renderer is updating the scene the cusor do flicker.
DdR> Somebody can give me a hint ?
DdR> Thanks in advance.
DdR> Daniel del Rio.
DdR> ===========================================================================
DdR> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
DdR> of the message "signoff JAVA3D-INTEREST". For general help, send email to
DdR> [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".