I fail to understand the rules for updating Draw2D ops. My expectation is that bm.Finish() should update any cached drawing ops. However, when I GetByteArray(), there is nothing there. The following is a minimal working example. I do a Clear(). DrawRect(), Finish(), GetByteArray() and then manually write a value into the red byte. Then I print the byteArray. It's "empty", except the red value.
I display the bitmap and it looks as expected (minus the red pixel, of course). I GetByteArray() again, and now the Draw2D stuff is there! Do I misunderstand bm.Finish()? Or is this a bug?
It would help the readability of your code tremendously if you enclosed it in code tags (click the 3 dots and look for </>).
The first thing that jumps out is that you're creating a single buffered screen and using SwapBuffers which is for double buffered screens.
RenoJim, sorry about just dumping my code into the post. It's my first post with code and I didn't know how to include the example. Thanks for the tip.
I don't think buffering has any relevance to the issue. The example doesn't even need to be displayed. The issue is: draw into a bitmap, finish it, get the byte array, it's empty. It only takes 4 lines of code to reproduce. I just got verbose about it.
My guess it's an issue with caching of draw ops in OpenGL, but what do I know?
I just tried it and it does seem like a bug, but it would be hard to believe that no one noticed it by now. The bitmap seems to get updated when screen.Finish() gets called.
Thanks for trying it. For me, Finish() does not trigger the drawing. The only sure method has been to (when double buffered) perform a SwapBuffers.
I'm not surprised that no ones hit this. I'm post-processing a bitmap buffer and then displaying it. Who in their right mind wants to do that?
I'll snoop around and see if I can learn how to submit a bug report.