Jump to content
  • Advertisement
Sign in to follow this  
wisey

Double Buffering with D3D

This topic is 2378 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

Hi

I've written some code to demonstrate behavior systems with simple sprites and this link will take you to the forum that I made the initial post

http://forum.train2game.com/showthread.php/13483-A*-algorithm-Project-2

You can download the source from here but if you can't be bothered. Please take a look at this code: -

http://ideone.com/n03ct

My code is based on DirectDraw, which is now deprecated and I want access to matrices and other things that are possible with Direct3D. My problem is that I don't know how to setup double buffering in the same way that those project files do, using D3D. This is because I used somebody else's code and just built procedures that blitted sprites in interesting, behavior centric ways.

I need some help because I don't know D3D. I've read a little about the types but all their functions are different so its not so easy to re-factor.

--
Wisey

Share this post


Link to post
Share on other sites
Advertisement
Coming from a DirectDraw background you're used to having to create a surface for your backbuffer and handle your own flipping. The goood news is that you don't have to do this at all with Direct3D. Depending on which D3D version you're using the setup procedure will be different, but in summary all you need to do is create a Device and make Present calls; you've automatically got double-buffering with no manual intervention on your part required at all.

Share this post


Link to post
Share on other sites
That is exactly the answer I wanted since I'm looking at some demo code that uses D3D9 and when I saw the Present method I instantly thought that all the pixel shading data is passed into the Device before it is presented to the user. Oh btw, I'm only wanting to blit sprites. Do you know how I'd go about this? Does the device have a method which accepts sprites? Oh, i'm trying to follow this: -

http://www.toymaker.info/Games/index.html

--
Wisey

Share this post


Link to post
Share on other sites
You could look at the ID3DXSprite interface which is designed to make this kind of thing really easy. Alternatively check out StretchRect (but that's not really ideal).

Share this post


Link to post
Share on other sites
hi mhagain

could you take a look at this code and tell me why the sprite won't render in the center of the screen. I'm using my measuring tape and it doesn't like right either.

http://ideone.com/yk28L

I know its not triangles that i'm trying to draw but if you look at the [color=#000066]

DrawTriangle method the bottom of the code, that's where I tell it where to draw the sprite. I'm trying to re-factor the code so that I can work on porting the DirectDraw code I have. The sprite is 32 x 32.

--
Wisey

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!