Are Texture2D objects stored on the graphics card or on system memory? I am thinking that the backbuffer is located on the graphics card (by default) and that the textures are on the system memory. I am using a spritebatch class that writes the textures to the backbuffer which are then rendered when the Present() function is called. Is this how XNA does it or am I completetly off?


1 Answer 1


Texture2D objects are allocated on system memory, but the actual textures loaded from image files are, on the other hand, loaded on the graphics card's memory.

You are not completely off with your assumption, but here is how it goes when you want to load and render a simple texture:

  1. You load the texture into the graphics card's memory.
  2. You bind the texture to the current texture unit with glBind / using SpriteBatch.Begin().
  3. You render a quad on the back buffer and the graphics card fills the quad's pixels with the texture in the texture unit.
  4. When all rendering is done, you swap the back and front buffer. This is done automatically in most high level engines, but you still need to do it in SDL and XNA (Using GraphicsDevice.Present()).

To answer your questions and clarify your misunderstandings:

  • Texture are allocated on the memory of the graphics card.
  • The back buffer is located on the graphics card too.
  • When you call SpriteBatch.Begin(), you don't write the texture to the back buffer, you bind them to the GL_TEXTURE_2D texture unit.
  • When you draw the texture, it will write to the back buffer.
  • The back buffer is completely invisible, so in order to see what you rendered, you need to swap it with the front buffer (the one visible on screen).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .