Jump to content
  • Advertisement
Sign in to follow this  
anderson_geller

Problem about GDI drawing on surface

This topic is 3986 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

Hi, I'm working on a 3D clock program using C# with Managed DirectX. The 3D clock will be a cube showing different time on each side of it. First I create a cube(not using Mesh.Box but vertecis manually), that's easy, and each side has the same texture(from a bmp file). Next, I want do some GDI operations on each side of the cube. Each side of the cube is supposed to show a clock which consits of a cicle and two lines. I tried to get a Surface object from the texture by calling Texture.GetSurfaceLevel(0), and get a Graphics object from the surface by calling Surface.GetGraphics().Then I drew the clock with the Graphics object. The code is shown as following. -------------------------------------------- Surface sf = texture.GetSurfaceLevel(0); Graphics g = sf.GetGraphics(); g.DrawCircle(); sf.ReleaseGraphics(g); sf.Dispose(); --------------------------------------------- Then I got the problem. Once I draw something on the surface of a texture, the texture seems changed forever. I draw a clock on one side of the cube, it affects all the other sides. So should I need to load 6 textures for each side? My Environment: WindowsXP + XP2, DirectX 9.0c, VS2005 Any help is appreciated. Anderson

Share this post


Link to post
Share on other sites
Advertisement
Hi, you could try making a surface just for doing you gdi calls on this way your not changing your texture.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!