Frame Buffers

Sorry if this is a stupid question, but I am very

new to C# and any type of Microsoft game development. (I come from a

actionscript background, please do not laugh)

Is it possible to draw onto a virtual frame

buffer(I think that is what it would be) rather than directly onto screen? For

example, if I have a background set that is constructed from multiple sprites

that takes quite a lot of processing power, can I draw this once onto a frame

buffer and just reuse that frame buffer for proceeding redraws?

Any help appreciated!

Regards:


John
[844 byte] By [JohnHarding] at [2007-12-24]
# 1
Yes it's possible. It's been asked and answered several times in these forums. But please (especially if you are new to this type of programming) just implement your game without doing that, and verify that it is actually a performance problem worth adressing. The underlying Direct3D rendering system is an order of magnitude faster than anything you have done with flash.

If you keep all of your background sprites on one big texture, then the SpriteBatch object will render them all with a single draw call, which will have way more than sufficient performance without needing offscreen buffers.

KrisNye at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 2
The thing you are probably looking for is the ability to draw to a texture instead of the frame buffer. You can setup a new texture to be the render target and draw to it essentially "offscreen". Then display that texture when you need it. There are a few posts on the forum about this topic in XNA.
Deis at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 3
Well I suppose this is along the same lines, but is there an easy way to cache textures so that you dont need to keep calling them from their original file?
SlaserX at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...
# 4
Kris:

Many thanks for your advice. I am not experiencing performance issues just yet, I was just exploring if this would be possible.

SlaserX:
Check the Spacewar Starter Kit, it has a simple to understand AssetCache and TextureCache manager.

Regards:

John

JohnHarding at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,XNA Framework...