Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Garbage DrawPrimitive output

This topic is 5659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've written a simple mesh manager. It uses a vector of pointers to vertex buffers to store the meshes. It fills the VB by using ID3DXMesh and D3DXLoadMeshFromX method. Unfortunately the output of the vb seems to be seriously f'ed up. Here's a simple snippet designed to test the manager
	g_pDirect3DDevice8->SetTexture( 0, textureManager.GetTexture(1,NULL));	//terrain

	g_pDirect3DDevice8->SetStreamSource( 0, meshManager.GetVBByID(1), D3DXGetFVFVertexSize(meshManager.GetFVFByID(1)));

		g_pDirect3DDevice8->DrawPrimitive( D3DPT_TRIANGLELIST , 0, (1089/3) );
		g_pDirect3DDevice8->DrawPrimitive( D3DPT_LINELIST , 0, (1089/2) );
		g_pDirect3DDevice8->DrawPrimitive( D3DPT_POINTLIST , 0, 1089 );
Here's the output : Actual mesh (from ModelView) http://juozasg.netfirms.com/mview.png Point list http://juozasg.netfirms.com/point.png Line list http://juozasg.netfirms.com/line.png Triangle list http://juozasg.netfirms.com/tl.jpg I have no idea what's wrong so all suggestions are appreciated. Juozas Gaigalas EDITED: HTML troubles [edited by - Juozasg on June 19, 2003 3:45:40 PM] [edited by - Juozasg on June 19, 2003 3:48:50 PM]

Share this post

Link to post
Share on other sites
Are you sure that:

1) The data in the D3DX mesh isn''t triangle strips rather than a triangle list ?

2) The mesh isn''t indexed ? [Rendering an indexed mesh as non-indexed would definately give you similar to the output you''re getting]

Simon O''Connor
Insert Company Name Here

Share this post

Link to post
Share on other sites
Thanks for the respose. I think the indexed vertices are the source of problem. I assumed that unless I request for the index buffer, the vertices in the VB will be ready to use by the DrawPrimitive().

Do I need to use GetIndexBuffer() after loading a mesh, and then keep a copy of IB as well as VB (and SetIndices() on render), or is there a way to load the data into VB without worrying about indeces?

Both strips and lists give the same invalid picture, btw.

Juozas Gaigalas

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!