Sign in to follow this  

DirectX9 : Backbuffer?

Recommended Posts

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);

// my render code here


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]

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites
thanks Namethatnobodyelsetook

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

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this