Archived

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

billybob

index buffer problem

Recommended Posts

i have this code to set up the vertice grid for my terrain: for(yread = 1; yread < terrain_y - 2; yread++) { tay = tay + terrain_Tex; tax = 0; for(xread = 1; xread 2) { tVertBuf[vert] = IndexXY(xread, yread); tVertBuf[vert + 2] = IndexXY(xread+1, yread); tVertBuf[vert + 1] = IndexXY(xread+1, yread+1); tVertBuf[vert + 3] = IndexXY(xread, yread); tVertBuf[vert + 4] = IndexXY(xread, yread+1); tVertBuf[vert + 5] = IndexXY(xread+1, yread+1); vert = vert + 6; } else { tVertBuf[vert] = 5; tVertBuf[vert + 2] = 6; tVertBuf[vert + 1] = 7; tVertBuf[vert + 3] = 5; tVertBuf[vert + 4] = 6; tVertBuf[vert + 5] = 7; vert = vert + 6; } no matter what i do, there are always triangles i didn''t create going from the edges of the terrain to 0,0,0 in world space. the ''if xread''s'' are to try and cut off the edges of the terrain, but the triangles keep being created from the ''new'' edge. if i leave that code out, it makes trianlges from one side of the terrain, to the other. if drawIndexedPrimitve gets a triangle that doesn''t ahve a vertice set, what will it do? this may be my problem, but i don''t think so.

Share this post


Link to post
Share on other sites