[.net] From C++

Started by
4 comments, last by Xadja 17 years, 7 months ago
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!
Advertisement
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.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

yeah, I know, that there is a Pitch, but i dont know what is "rect.pBits"
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).

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Can you tell me please what this code do? May be i can do this in MDX.
"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 :)))

This topic is closed to new replies.

Advertisement