c++ - How do I set the color of a single pixel in a Direct3D texture? -
I am trying to drag a 2D image to the screen in Direct3D, which I believe is done by mapping To fill the screen, texture to the projected rectangular billboard polygon (I'm not interested or can not use direct 2D.) All the textual information found in the SDK describes loading a bitmap from the file and specifying a texture to use that bitmap, but I have not found any way to manipulate a texture as a bitmap pixel by pixels.
What I really like
Zero TextureBitmap :: SetBitmapPixel (int x, int y, DWORD color);
If I can not set the pixel directly into the texture object, then I need to place it around a DWS array which is a bitmap and then assign the frame to each frame. ?
Finally, when I was initially thinking that I would do this on the CPU, the per-pixel color count could also be on the GPU too. HLSL code which sets the color of a pixel in a picture, or is pixel shader useful for modifying pixels only?
Thank you.
You can create, technically, set the pixels in a texture. It will need to be used and the API
In D3 context, 'locking' refers to usually transferring resources from system memory to system memory (thereby deactivating its participation in rendering operations ) Once locked, you can modify the populated buffer as your choice, and then unlock - that is, move the modified data back to the GPU. Locking was generally considered to be a very expensive operation, but since it's probably not a big concern anymore. You can also specify LockRect as a second argument (1-pixel) RECT, requiring the memory-transfer of a negligible data volume, and hopes that the driver is actually sufficient to move enough (I know for a fact that this was not the case in older NVIDI drivers).
The more efficient (and code-intensive) method of obtaining it, is to never leave the GPU if you specify it as a render tag (i.e., the D3UUSCNRRTTEGET as its argument) , You can set it as the destination of the pipeline before making a draw call, and you can write a shredder (perhaps) to paint your pixels. This kind of render target is considered to be standard, and you should be able to find many code samples - but as long as you are not already experiencing performance problems, I can say that it is a single 2 D is overwork for billboards.
> HTH
Comments
Post a Comment