Re: Sprite problem
- From: Stephan Rose <ker-spam-mos@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 18 Nov 2005 10:33:35 +0100
On Fri, 18 Nov 2005 06:38:00 +0100, "Martin" <NOSPAM@xxxxxx> wrote:
>I'm using Direct3D 9 and I want to copy a texture to the backbuffer.
>optional the user should be able to tell my application, that it will drag
>the texture to backbuffer width and height.
>but this method call doesn't work.
>mySprite.Draw2D(myTexture, new Rectangle(0, 0, width, height),
>bImageDragging?new Rectangle(0, 0, ScreenWidth, ScreenHeight):
>new Rectangle(0, 0, width, height), new Point(0, 0), Color.White);
>what i get is a white background (because i clear the background with white
>color) i want to copy the texture to the backbuffer. while doing this i
>disable writing to depth buffer because i want to draw 3d objects after
>setting the background image. any ideas?
Why not just create your texture that you want as your background,
then render it to your backbuffer using 2 triangles?
Basically create a quad the size of your backbuffer using transformed
vertices, texture them with your background image, and render the
For one, you can now save your clear backbuffer because this will
fully cover the backbuffer, and the image will be automatically scaled
This also works if you want to draw an image smaller than the
backbuffer size as a background and do not want to scale, just adjust
your quad size and position to be the exact size of the image you want
to draw. In this case however, you would need to clear if you dont
have any other geometry to draw in the uncovered areas.
2001 Yamaha YZF-R6 <--- Stolen
- Sprite problem
- From: Martin
- Sprite problem