tags:

views:

93

answers:

1

In XNA, you can do

texture = new Texture2D( GraphicsDevice, width, height ) ;

I'm guessing somewhere deep down in the MSFT bowels, this is equivalent to C++ code:

D3DXCreateTexture( GraphicsDevice, width, height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture ) ;

In XNA there's this nifty function that lets you set the pixel values of a texture you've created:

texture.SetData<Color>( new Color[]{ pixel, values, pixel, values ) ; 

Now I'm pretty sure there's got to be a C++ DirectX equivalent. Anyone know what it is?

+2  A: 

I found it.. IDirect3DTexture9::LockRect()

bobobobo
Well, that only get the pointer to the data, please remember that not all the type of texture are lockable in DX9. (render target or depth textures are not lockable.)IN those case use UpdateSurface to update textures/surfaces. (only for render target as depth textures are not updatable (except for some cards with hacks))
feal87