Using Sprite to draw 2D graphics

Hi all,

I use Sprite class to draw Bitmaps on the screen. In the sprite class, I only know how to do some simple effects on the texture, such as setting the transparency.

The problem is that I want those textures to be affected by Lighting.
E.g. If the color in the texture is blue, the outcome result is Green.
Also I want to do other effects like a spot light on the texture. I have read a book (C++) and seems that I have to use "device->draw primitives" instead of Sprite to do such effects. But I don't know whether there are simply ways to do that(in C# and MDX).
Thank you


Answer this question

Using Sprite to draw 2D graphics

  • guru13

    You cannot make sprites (i mean ID3DXSprite drawn textures) be affected by lighting or any other effect.

    You should study the 3D rendering basics.

    The trick is to draw a screen aligned quad, with the appropriate texture.



  • Romit

    Hi!

    You can load bitmap with transparency layer (alpha layer).



  • Ashraf

    I am reading a book that has a chapter in on the basics of Managed DirectX, in this chapter there are some small samples that will help you do the task at hand.

    I would suggest having a look at it, although it is using an older version of the SDK, the principles are the same. Check out "Beginning .Net Game Programming in C#, by David Weller and co"

    You might want to do some searching and research on Textured Quads on www.gamedev.net and on Google.



  • Using Sprite to draw 2D graphics