Sign in to follow this  
MrCpaw

XNA Buffers

Recommended Posts

I'm confused on how to go about making different buffers. I come from using C and C++ and with the API's I used I needed to setup my own buffers and have the option of having a buffer on the left and right. Which really is no different then having two bitmaps which you draw on. I wanted to do the same within XNA, however I'm unsure on how to go about doing so. I know in XNA you just use spriteBatch.Draw() to draw on the screen. However, I'm more use to doing something like this: draw(Buffer, GFX, X, Y, ect...); How would I go about setting up two buffers?

Share this post


Link to post
Share on other sites
Read up on MSDN for the constructors for SpriteBatch, you can specify a position and a size for your textures to be drawn to.

By buffers I'm assuming you mean render target textures.

Share this post


Link to post
Share on other sites
Thanks, I'll be sure to check that out and post back later if I still run into any problems.

Share this post


Link to post
Share on other sites
Are you talking about vertex and index buffers? These are available in XNA with pretty much the exact same functionality that's available in native D3D9. You can just create new instances of VertexBuffer and IndexBuffer, fill them with data using SetData, and then use GraphicsDevice.DrawIndexedPrimitives to draw them.

Share this post


Link to post
Share on other sites
What I was looking for was RenderTarget2D. Thanks for the help, I've been able to successfully setup my drawing areas.

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