Sign in to follow this  

Unhandled Exception when loading vertex buffer

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

Hey Guys..When i run my program..an unhandled exception message shows up

the details are

+ this 0x019f5ae0 {_device=0x02394320 _tex=0xcdcdcdcd _vb=0x0073e860 ...} Terrain * const
endX 315 int
hr S_OK HRESULT
startX -315 int
startZ 315 int
endZ -315 int
i -858993460 int
uCoordIncrementSize 0.015873017 float
vCoordIncrementSize 0.015873017 float
+ v 0x00000000 {_x=??? _y=??? _z=??? ...} Terrain::TerrainVertex *

the corresponding code is
[ source ]
TerrainVertex *v=0;
_vb->Lock(0, 0, (void**)v,0);
int i=0;
for(int z = startZ; z >= endZ; z -= _cellSpacing)
{
int j=0;
for(int x = startX; x <= endX; x += _cellSpacing)
{
int index= i*_numVertsPerRow +j;
v[index]= TerrainVertex((float)x, (float)_heightMap[index], (float)z, (float)i* uCoordIncrementSize, (float)j * vCoordIncrementSize);
j++;
}
i++;
}
_vb->Unlock();
[ /source ]

this is my entire program ,should the information not suffice
http://pastebin.com/TQdEpfVD

Share this post


Link to post
Share on other sites
What like does the exception occur on? What is the exact message? If it occurs on the v[index]= TerrainVertex(... line, then index probably refers to an invalid vertex (I.e. < 0 or >= _numVertices).

Share this post


Link to post
Share on other sites
Hey thanks..mhagain..no more exceptions :)..but still nothing shows up on my screen...its just blank...i am working on it now..and i have a hresult check on all the functions and i get no notice of any failure.

Share this post


Link to post
Share on other sites

This topic is 2659 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.

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