Skip to main content
gamedev.net
🔒 Locked

DirectX9 : Backbuffer?

Started by tlc660 Aug 19, 2006 at 10:39 AM 5 replies 2.7k views
Original Post
tlc660
tlc660
me are new to DirectX9. to start my first C# DirectX9 2D application me have grab a tutorial from MSDN WebCast which a project call "StarTrooper". by following the tutorial from start to end, me have success to create my first 2D snake game with Direct3D.Sprite class. but there have few quetion are confusing me. me have did a 2D application with DirectX8 DirectDraw and VB6 long long time ago. as me memorized, in DirectDraw we have to create a device(same to Direct3D now) and 2 Surface(one for the primary Surface and another for the backbuffer), after we draw on the backbuffer and flip it to primary surface. but which in "StarTrooper", me cant found any called "backbuffer". here my code
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.DeviceWindow = myGameWin;
presentParams.PresentationInterval = PresentInterval.Immediate;

device = new Device(0, DeviceType.Hardware, myGameWin, CreateFlags.HardwareVertexProcessing, presentParams);
Sprite scene = new Sprite(device);

device.Clear(ClearFlags.Target, Color.Black, 1.0f, 0);
device.BeginScene();

scene.Begin(SpriteFlags.AlphaBlend);
// my render code here
scene.End();

device.EndScene();
device.Present();

is it Direct3D.Sprite already handle the "backbuffer" automatically? thanks a lot and sorry for my poor english. [Edited by - tlc660 on August 19, 2006 11:09:10 AM]
imbusy
imbusy
device.Present();

This flips the buffers automatically.
tlc660
tlc660
thanks imbusy
so, the Direct3D.Sprite act as "Surface" which did in DirectDraw?
imbusy
imbusy
I've never used DirectDraw, but I guess not.
tlc660
tlc660
thanks again.

do you have some guide/tutorial/example for
2D in Direct3D 9 ?
Namethatnobodyelsetook
Namethatnobodyelsetook
When you create a D3D device it allocate it's front and back buffer(s). In the presentation parameters you pass to create device is a back buffer count, and a back buffer format. You can pass D3DFMT_UNKNOWN (or 0) as the format when using windowed mode to get a backbuffer format that's the same as the desktop. The backbuffer size can also be specified here. If it's set to 0, it will default to the size of the window's client area. For fullscreen, the mode and backbuffer sizes must be specified as they describe which full screen display mode and resoltion to switch to.
tlc660
tlc660
thanks Namethatnobodyelsetook

so the Direct3D.Sprite not the "surface" but which are point to and use the "device"'s
backbuffer?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.