Jump to content
  • Advertisement
Sign in to follow this  
tlc660

DirectX9 : Backbuffer?

This topic is 4354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Share this post


Link to post
Share on other sites
Advertisement
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
backbuffer?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!