BITMAP* tex[10];
int& pixel(BITMAP* bmp, int x, int y)
{
return ((int**)(bmp->line))[y][x];
}
but what's the syntax for this in DirectX?
Posted 31 May 2012 - 03:42 PM
Posted 31 May 2012 - 03:43 PM
You need to call Map() on the texture to get access to the texture data. Don't forget to call Unmap() afterwards. You will have had to create the texture with the proper flags to be able to write to the texture.
ID3D10Texture2D
[in] UINT Level, [out] D3DLOCKED_RECT *pLockedRect, [in] const RECT *pRect, [in] DWORD Flags
Edited by Bogomil, 31 May 2012 - 04:08 PM.
Posted 31 May 2012 - 04:40 PM
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
Posted 31 May 2012 - 05:52 PM
the OP did tag the question as [D3D9].
Posted 31 May 2012 - 07:07 PM
Posted 31 May 2012 - 08:10 PM
Edited by InvalidPointer, 31 May 2012 - 08:10 PM.
Posted 31 May 2012 - 09:25 PM
Since this hasn't been asked yet, I'll go ahead and bite the bullet: What Are You Doing, Really? Any time the subject of CPU readbacks come up, there's like a 90% chance a better way to do what you're trying to accomplish exists.
Posted 31 May 2012 - 09:39 PM
The client really should be the one generating this stuff, sending actual assets over the network isn't the best use of bandwidth (of course, maybe you have something different in mind, but from what you said it sounds like an overly complicated method to do things)
Since this hasn't been asked yet, I'll go ahead and bite the bullet: What Are You Doing, Really? Any time the subject of CPU readbacks come up, there's like a 90% chance a better way to do what you're trying to accomplish exists.
Well,I have a server program that sends to the client a data struct with info for the current terrain piece.The info is generated randomly by the server and sent to the client,so I want the client to draw a terrain blendmap with the info from the received struct and then use the blendmap in the shader.This only happens when the client receives a new terrain piece(the player walks into a new zone)or when he burns the ground or something.Still it's not every frame,so I suppose it shouldn't cause a noticeable slowdown?
Posted 31 May 2012 - 09:51 PM
The client really should be the one generating this stuff, sending actual assets over the network isn't the best use of bandwidth (of course, maybe you have something different in mind, but from what you said it sounds like an overly complicated method to do things)
Edited by Bogomil, 31 May 2012 - 09:54 PM.
Posted 01 June 2012 - 08:45 PM
Edited by InvalidPointer, 01 June 2012 - 08:47 PM.