Re: Sprite problem



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
quad.

For one, you can now save your clear backbuffer because this will
fully cover the backbuffer, and the image will be automatically scaled
to fit.

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.

--
Stephan
2001 Yamaha YZF-R6 <--- Stolen
.



Relevant Pages

  • Re: 2D Image
    ... You get an interface pointer to the top level of that texture ... DEFAULT memory and again use Updatesurface to transfer your local surface to ... Your backbuffer has to be lockable. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: GDI, DirectX and Vista
    ... could I alternately present the back buffer and the drawing surface? ... (Presenting the backbuffer would be equivalent to erasing the lines). ... I'd draw the 2D and 3D thing into separate texture (meaning ... In the other posting, you ask about transparency. ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: 2D Image
    ... display on a rather slow CPU with a fairly basic video ability. ... best way to transfer my image to the backbuffer, How do I get a pointer the ... the front-buffer in near future) is meant to be handled by the gpu, ... One way to do this is to create a texture with d3dusage_dynamic (and ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Sprite problem
    ... I'm using Direct3D 9 and I want to copy a texture to the backbuffer. ... bImageDragging?new Rectangle(0, 0, ScreenWidth, ScreenHeight): ... what i get is a white background (because i clear the background with white ...
    (microsoft.public.win32.programmer.directx.managed)
  • Copy backbuffer to Texture
    ... I render scene to backbuffer and copy it to texture, then draw the ...
    (comp.graphics.api.opengl)