According to the documentation on:
http://java.sun.com/javase/6/docs/api/java/awt/image/BufferStrategy.html

One is supposed to
do {
       Graphics graphics = strategy.getDrawGraphics();
       //render here
       graphics.dispose();
} while (strategy.contentsRestored());

So I did that where I render:
do {
   do {
         bg = (Graphics2D)bs.getDrawGraphics();
         mis.newPixels(pixels, cm, 0, thisW);
         bg.drawImage(canvasImage, 0, 0, thisW, thisH, this);
         drawAttribution();
         bg.dispose();
    } while (bs.contentsRestored());
    bs.show();
} while (bs.contentsLost());

So I'm disposing of bg -- the BufferStrategy graphics after I render.

The question is -- how come I can still use the buffer graphics (bg)
at other times to draw stuff.  My applet draws onto the BufferStrategy (bs)
in many other places at various times.  And it works and all the while
I have dispose()'ed of the buffergraphics (bg) and the loop above is the only
place I getDrawGraphics();

For example -- here's my paint() method -- no problem -- no drawGraphics.

public void paint(Graphics g)
{
       //System.err.println("paint()");
       bg.drawImage(canvasImage, 0, 0, thisW, thisH, this);
       if(DRAWATT)
           drawAttribution();
       bs.show();
}

I don't understand that...

Ken

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to