XNA Essentials

Game Programming for Xbox 360, PC + Windows Phone

NAVIGATION - SEARCH

VertexBuffer - ALittle More Info

Hi Chad,



Firstly let me congratulate you on your book excellent (3.0 version). It is so satisfying to read a book that starts from 3D first. I have started C# about 15 weeks ago, and me a couple of colleagues started a little competition to learn to make a game in 8Weeks to learn and develop our skills:


 


http://8weekgame.shawson.co.uk/


 


We finished the games and was a success. I learnt loads from online tutorials and another book "Learning XNA..." which was good. Using the knowledge i have already built up i took the plunge and purchased yours. I thought 3D would be daunting, and it is! Im only on Chapter 4 and lot of concepts i have to re-read to grasp, but im taking it slow so i can take it in. Anyway, i have a question pertaining to the Vertext Buffers (Page 75). NOw i know Vertext Buffers are lists in memory to hold arrays of vertices, which is good. Just one question, is that memory used the Graphic Cards or normal onboard motherboards (Same question for Xbox and PC).


 


Im just wanting to cement my knowledge before moving on.



Cheers Chad :)

garfbradaz - Tuesday, August 17, 2010 @ 3:24 PM

Re: VertexBuffer - ALittle More Info

I'm glad you are enjoying the book!  Sorry it took me a little while to respond - this week has been busy.


You may find this powerpoint interesting:


http://gpgpu.org/static/s2005/slides/lefohn.MemoryModelOverview.ppt


 

Chad Carter - Monday, August 23, 2010 @ 7:18 AM

Re: VertexBuffer - ALittle More Info

This is very interesting Chad, much appreciated. Another question (sorry!) Does the Garbage Collection run against GPU as well then? Or is this handled by the Graphics Card it self? I only ask because i thought a GPU memory is write only? Or does that mean each scenes vertex data is overriitten.

garfbradaz - Monday, August 23, 2010 @ 9:53 AM

Re: VertexBuffer - ALittle More Info

Garbage Collection is done by the .NET Framework.  So garbage collection is only done on the main machine's memory and not the GPU's memory.  The SetData call is overwriting the vertex buffer every time. 

Chad Carter - Monday, August 23, 2010 @ 10:34 AM

Re: VertexBuffer - ALittle More Info

Thanks Chad, makes perfetc sense, thank you :)

garfbradaz - Monday, August 23, 2010 @ 11:56 AM

Re: VertexBuffer - ALittle More Info

Here is some more information regarding vertex buffers and how they work now in 4.0. 


http://blogs.msdn.com/b/shawnhar/archive/2010/07/07/setdataoptions-nooverwrite-versus-discard.aspx


 Just figured I would pass it along.  Definitely make sure you are keeping an eye on Shawn Hargreaves blog if you aren't already.  He was the technical editor of my original book and he has tons of great information.

Chad Carter - Friday, August 27, 2010 @ 5:37 AM