Queuing data into swapchain of IDirect3DDevice9
I am new to direct开发者_如何学编程3D . I am trying to write an image on direct3ddevice and get the same image in xrgb from it. I create a texture and get the surface from GetSurfaceLevel(). I use a image file and convert it into ARGB and write it onto the locked suface from texture. But how should I proceed further to queue this data into the swapchain so that I can get the same data in XRGB using GetBackBuffer() call on Direct3DDevice??
I want to do this, as I want to further play with textures and data from sources to apply special effects such as compositing images (one containing an alpha channel over another in rgb) using direct3d.
First off you don't need to manually lock your texture to put image data into it. You want to be using
if(FAILED(D3DXCreateTextureFromFile(Device, fileName, &texture)))
{
//handle error
}
If you want some simple samples for reference on D3D9 go here:: http://www.codesampler.com/dx9src.htm
If you just want to make games, you could try unity3D:: http://unity3d.com/
精彩评论