[.net] From C++
Hi!
How this will be look in MDX C#:
D3DLOCKED_RECT rect;
unsigned short *data;
int tempdata[size];
for(int t=0; t<2; t++)
{
int offset = size*t;
texture[t]->LockRect( 0, &rect, NULL, D3DLOCK_DISCARD );
data = (unsigned short*)rect.pBits;
for(int i=0; i<size; i++)
data = 32768+mass[i+offset];
texture[t]->UnlockRect( 0 );
}
Thanks for help!
I can't help with the MDX part, but this snippet is prone to crash.
There is a pitch in the D3DLOCKED_RECT struct, also in the MDX version. Use it.
Only copy the image data per line. The drivers are allowed to add optimising data in between.
There is a pitch in the D3DLOCKED_RECT struct, also in the MDX version. Use it.
Only copy the image data per line. The drivers are allowed to add optimising data in between.
rect.pBits is a pointer to the image data, more exact, the top left corner of it.
I think in that case you can either use unsafe code and use the pointer or point a byte[] to that address (not sure if that works easily).
I think in that case you can either use unsafe code and use the pointer or point a byte[] to that address (not sure if that works easily).
Can you tell me please what this code do? May be i can do this in MDX.
"data" What do this pointer change?
"data" What do this pointer change?
I made it! :)))
Rectangle rect=new Rectangle();
int* data;
int[] tempData=new int[size];
for(int t=0;t<2;t++)
{
int offset = size*t;
GraphicsBuffer buffer = Texture[t].Lock(0, rect, LockFlags.Discard);
data = (int*) buffer.DataBufferPointer;
for(int i=0;i<size;i++)
{
data = 32768 + mass;<br>}<br>Texture[t].Unlock(0);<br><br><br>Thanks for reading this post :)))
Rectangle rect=new Rectangle();
int* data;
int[] tempData=new int[size];
for(int t=0;t<2;t++)
{
int offset = size*t;
GraphicsBuffer buffer = Texture[t].Lock(0, rect, LockFlags.Discard);
data = (int*) buffer.DataBufferPointer;
for(int i=0;i<size;i++)
{
data = 32768 + mass;<br>}<br>Texture[t].Unlock(0);<br><br><br>Thanks for reading this post :)))
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement