> This is a serious
> drawback for us in implementing VolatileImage objects because
> it is impossible to have an outstanding pointer to ddraw (on win32)
> pixels while that surface is not locked. The only way to work
> around this mismatch between our API and ddraw is to punt on
> acceleration whenever anyone requests access to the pixels.
If I was working with Direct Draw and C, I would lock my staging buffer, modify the
pixels, unlock it, and then blit it to the back buffer. How come I can't do this with
a VolatileImage? Can't you expose lock/unlock and a method to get the native data as a
jni ByteBuffer?
> But make sure to copy the data from the staging
> buffer in a way that does not get a pixel pointer (e.g., getRaster())
> from the VolatileImage.
>
> So, for example, if vImg is your VolatileImage and stage
> is your staging buffer:
> Graphics2D g = (Graphics2D)vImg.getGraphics();
> g.drawImage(stage, 0, 0, null); // this assumes you want
> // to copy the entire buffer; you could copy
> // a subrectangle instead
> This approach would allow us to copy the pixels in the staging buffer
> without violating the policy of pixel access.
This is exactly what I am doing right now. It works great, I get 100+ frames a second.
However as soon as I call stage.getRaster() so that I can modify the staging buffer's
pixels, my frame rate drops to 15 frames a second. I haven't even added the code to
actually modify the pixels yet, the call to getRaster() itself is causing the dramatic
drop in frame rate. So this doesn't seem like a viable solution, at least with the
current implementation.
Even if it does work in the future I would still much prefer the
lock/unlock/ByteBuffer solution because I want to modify the data on the C heap, not
the Java heap, because it is likely to be much faster.
- John
===========================================================================
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".