#### Archived

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

# Nasty DrawIndexPrimitive problem

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

## Recommended Posts

Hi, I've been working on this problem for ~6 weeks without success. Basically, I am trying to draw a 35 vertex x 35 vertex grid (a tile for a landscape engine I am working on) using DrawIndexedPrimitive with triangle lists. I divide eah tile into a center and a boarder 1 space wide. (to be used later as a way to knit multiple tiles together at different levels of detail). I have all the vertices in a vertex buffer and use an index buffer to draw it all. The index buffer starts out drawing the center of the tile and then starts drawing the boarder. So far, I don't get anything drawing on the screen. I've been over and over the vertex and index buffer contents (I output them to a file) and they look flawless. Also, I've check and re-checked the values I'm sending in as arguments to DrawIndexrimitive() so I'm 99.999% sure they they're right. I make sure there is nowhere near 65,000 indices in the index buffer. I tried limiting the geometry to a smaller test subset to see ifmaybe I was making the VB too large (I 'm filling the VB with many tiles worth of geomtery). Even with the limited geometry I'm still not seeing anything. The one funny thing I'm doing is that I am starting out each row of traingles with a degenerate triangles as a way to "prime" the vertex cache so that I can take as much advantage of the vertex cache as possible. The test data I've been working with looks like this: index_buffer = {4, 7, 10, 4, 7, 8} vertex_buffer = { (0,0,0), (1,0,0), (2,0,0), (0,1,0), (1,1,0), (2,1,0), (0,2,0), (1,2,0), (2,2,0), (0,3,0), (1,3,0), (2,3,0) } this is the rendering code:

// Set the stream source

if( D3D_OK != m_pd3dDevice->SetStreamSource( 0, m_pVB, sizeof(CUSTOMVERTEX) ) ) {
FatalError("Couldn't SetStreamSource");
}

// Set the source for the indices

if( D3D_OK != m_pd3dDevice->SetIndices( m_pIB, tiles[i].VB_start ) ) {
FatalError("Couldn't SetIndices");
}

if( D3D_OK != m_pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ) ) {
}

m_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 11, 0, 2);

I know that tiles[ i ].VB_start is set to 0. In the future this will be inside a loop that will render each visible tile. If anyone knows what might be wrong I'd be extremely greatful. At this point I'm 6 weeks into a 10 week college course and my code still doesn't draw anything to the screen. -Daedalus [edited by - Daedalus on April 17, 2002 6:26:07 PM]

##### Share on other sites
Have you checked the backface culling mode?

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 9
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
633331
• Total Posts
3011394
• ### Who's Online (See full list)

There are no registered users currently online

×