• Advertisement

Archived

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

DX8 Dynamic VB Reset Problems

This topic is 5511 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

My dynamic vertex buffers seemingly do not render after I have resized my screen. When the screen is resized the VB is safely released then restored with: if(FAILED(g_Graphics.GetDeviceCOM()->CreateVertexBuffer( 4096 * 3 * sizeof(VERTEX), D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_VERTEX, D3DPOOL_DEFAULT, &m_pVB ))) return E_FAIL; Ordinary VB''s that use a different type of pool are rendered without problem but when I render this one, nothing appears. Nothing seems to fail for I have stepped through my code. All my breaks at each possible failure do not occur either. Does anyone know of any good code to help me at all? Thanks...

Share this post


Link to post
Share on other sites
Advertisement
Well, you''ve recreated the vertex buffer, but you haven''t refilled it. So, at least based on what you''ve posted, you''ll be rendering an empty vertex buffer.

Share this post


Link to post
Share on other sites
Oh, sorry. I should have posted this as well:

    
VERTEX *src_v;

if(FAILED(m_pVB->Lock(0, 0,
(BYTE **) &src_v, D3DLOCK_DISCARD)))
return E_FAIL;
// go through the list of polys one by one and render then

for(int prim_cnt = 0; prim_cnt < NumTris; prim_cnt++)
{
// go through all the indices, and texture co-ordinates for this poly

for(int index_cnt = 0; index_cnt < 3; index_cnt++)
{
int tindex = Tris[prim_cnt].TxrIdc[index_cnt];
int vindex = Tris[prim_cnt].VtxIdc[index_cnt];

float tex_coord_s = TxrCoord[tindex].s;
float tex_coord_t = TxrCoord[tindex].t;

float x = Frames[0].Verts[vindex].x;
float y = Frames[0].Verts[vindex].y;
float z = Frames[0].Verts[vindex].z;

src_v[prim_cnt*3+index_cnt].x = x;
src_v[prim_cnt*3+index_cnt].y = y;
src_v[prim_cnt*3+index_cnt].z = z;
src_v[prim_cnt*3+index_cnt].tu = tex_coord_s/256.0f;
src_v[prim_cnt*3+index_cnt].tv = tex_coord_t/256.0f;
}
}
if(FAILED(m_pVB->Unlock()))
return E_FAIL;


[edited by - Drath on January 20, 2003 3:00:54 PM]

Share this post


Link to post
Share on other sites
On top of that, the vertex buffer is refilled each frame with different coordinates that work fine before the window resize.

Share this post


Link to post
Share on other sites
Okay, I really have no idea what I have done wrong. Am I messing up in my reset or something?

Share this post


Link to post
Share on other sites

  • Advertisement