• Advertisement
Sign in to follow this  

Writing onto a Sufrace in Managed DirectX

This topic is 4951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem with writing to a surface with DirectX and C#. The thing is, that i create a texture, from a bitmap, and then i wand to write to that surface the hash code of the Red color.
private void PlayWithTexture(Texture tex)
	int hash;
	Bitmap bit = bmp1;
	Surface surf = null;
	int levelCount = tex.LevelCount;
	surf = tex.GetSurfaceLevel(0);
	Color clr;

	int []hasharray = new int[100];
	for(int i=0; i< 100; i++)
        hasharray = hash;

	GraphicsStream gs;
	gs = surf.LockRectangle(LockFlags.None);
	catch(Exception e)

and that's the code for initializing the Bitmap, and the texture
Bitmap bmp3 = null;
Texture tex2 = null;
bmp3 = new Bitmap(this.GetType(),"Bean.bmp");
tex2 = new Texture(device,bmp3,0,Pool.Managed);

it runs, but i still see only the bitmap, i thought i would see at least a piece of the bitmap turned to red. In a C++ sample, CaptureTex9, they use a pointer to the surface, and Lock it, and edit it, how can i do something like that in C#? Edited by Coder: Used source tags. Note that GDNet code and source tags use square brackets[] instead of angle brackets <>. Source tags even have support for C# syntax highlighting. See GDNet Forums FAQ for details [Edited by - Coder on August 5, 2004 4:44:54 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement