Reputation: 51
I have a paint program that I want to change a specific pixel when you click. How can I do this?
I know that I can create a Color[] of the background image but I need it to update rapidly while the screen is changing
Upvotes: 0
Views: 147
Reputation: 169
For C#/XNA, you can create a dynamic texture buffer, and a bitmap image in CPU memory that you copy to the GPU dynamic buffer whenever changes are made... The bitmap class has methods for manipulating pixels so the only part you are really left to figure out is how to map GPU memory and copy the bitmap to the texture buffer. This copy operation is fairly fast.. we use a similar technique to get our HTML HUD to display in our game engine (not XNA based unfortunately) and even with updates every frame we are still over 60fps.
Upvotes: 1