Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 03 Feb 2011
Offline Last Active Jan 31 2013 11:58 PM

Posts I've Made

In Topic: XNA 4.0 - Looking for quad hardware instancing tutorial

04 February 2011 - 09:27 AM

Ah thank you for clearing that up looks like I had my terminology wrong. I was able to use that phone example to create exactly what I needed and I am getting fantastic performance. 60 frames rendering 10,000 quads with a 128x128 texture! Thanks for your help guys.

EDIT: And that link is the one I was talking about that is too complex for me.

In Topic: XNA 4.0 - Looking for quad hardware instancing tutorial

03 February 2011 - 10:03 AM

This XNA tutorial is for windows phone, but it should run on a PC somewhat effortlessly. It basically draws a textured cube and builds the vertex information in the code. It'll at least point you in the right direction. http://blogs.msdn.co...ws-phone-7.aspx

That is a very nice example but sadly is doesn't use hardware instances to draw that cube, just uses standard primitives. Thanks though!

EDIT: Wait, I could be wrong here. I thought that it requires you to use the DrawIndexedPrimitive but that one is setting a vertex buffer. I'll look more into it and get back to ya'

EDIT 2: Fantastic, as long as this is actually doing it this is perfect. Has 4 of my major questions in it right off the bat.

public void RenderToDevice(GraphicsDevice device)
        	// Build the cube, setting up the _vertices array
        	if (_isConstructed == false)
        	// Create the shape buffer and dispose of it to prevent out of memory
        	using (VertexBuffer buffer = new VertexBuffer(
            	// Load the buffer

            	// Send the vertex buffer to the device

        	// Draw the primitives from the vertex buffer to the device as triangles
        	device.DrawPrimitives(PrimitiveType.TriangleList, 0, NUM_TRIANGLES);        	

So is this a legit way of doing hardware instaces? I take it that you just build all the objects in the same vertex declare and then load them into the buffer.