Sign in to follow this  
ThunderMusic_80

problem with ATI and DrawIndexedPrimitives

Recommended Posts

Hi, I was wondering if anyone has some troubles using DrawIndexedPrimitives with an ATI video card? Trying to run the example on indexed primitives downloaded from this site (http://www.codesampler.com/dx9src/dx9src_2.htm#dx9_indexed_geometry) I get a driver error when the device tries to present the rendered primitive (when the program calls the Present() method after drawing indexed primitives). I have an ATI Radeon All-In-Wonder card with 32MB on it. It's not much memory, but it should not matter because the program only tries to draw a cube... For those of you who don't want to download the code, here is the Render() method :
private void Render()
{
	d3dDevice.Clear( ClearFlags.Target | ClearFlags.ZBuffer, 
                             Color.FromArgb(255, 0, 0, 0), 1.0f, 0 );

	d3dDevice.BeginScene();

        d3dDevice.Transform.World = Matrix.RotationYawPitchRoll( Geometry.DegreeToRadian(spinX),
                Geometry.DegreeToRadian(spinY), 0.0f) * 
                Matrix.Translation(0.0f, 0.0f, 5.0f);

	if( useIndexedGeometry == true )
	{
		d3dDevice.VertexFormat = Vertex.FVF_Flags;
		d3dDevice.SetStreamSource( 0, vertexBuffer_indexed, 0 );
		d3dDevice.Indices = indexBuffer;

		d3dDevice.DrawIndexedPrimitives( PrimitiveType.TriangleStrip, 0, 0, 8,  0, 2 );
		d3dDevice.DrawIndexedPrimitives( PrimitiveType.TriangleStrip, 0, 0, 8,  4, 2 );
		d3dDevice.DrawIndexedPrimitives( PrimitiveType.TriangleStrip, 0, 0, 8,  8, 2 );
		d3dDevice.DrawIndexedPrimitives( PrimitiveType.TriangleStrip, 0, 0, 8, 12, 2 );
		d3dDevice.DrawIndexedPrimitives( PrimitiveType.TriangleStrip, 0, 0, 8, 16, 2 );
		d3dDevice.DrawIndexedPrimitives( PrimitiveType.TriangleStrip, 0, 0, 8, 20, 2 );
	}
	else
	{
		d3dDevice.VertexFormat = Vertex.FVF_Flags;
		d3dDevice.SetStreamSource( 0, vertexBuffer, 0 );
		d3dDevice.DrawPrimitives( PrimitiveType.TriangleStrip,  0, 2 );
		d3dDevice.DrawPrimitives( PrimitiveType.TriangleStrip,  4, 2 );
		d3dDevice.DrawPrimitives( PrimitiveType.TriangleStrip,  8, 2 );
		d3dDevice.DrawPrimitives( PrimitiveType.TriangleStrip, 12, 2 );
		d3dDevice.DrawPrimitives( PrimitiveType.TriangleStrip, 16, 2 );
		d3dDevice.DrawPrimitives( PrimitiveType.TriangleStrip, 20, 2 );
	}

	d3dDevice.EndScene();

	d3dDevice.Present(); // Crash on this line with indexed primitives
}
[/Code]

Anyone knows about a solution to this?

thanks

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