이것은 이전 질문에 대한 후속 조치입니다. 모든 나의 질문은 나의 마지막 실에서 대답되었지만 이것은 내가 가지고있는 새로운 오류이다. 중간 모드로 렌더링하면 모든 것이 멋지게 보입니다. 사실glDrawRangeElements()가 올바르게 작동하지 않는 렌더링
: http://i.imgur.com/OFV6i.png
지금, 나는 glDrawRangeElements()로 렌더링 무슨 일이 일어나는지 살펴 오전 :
사람이 전에 이런 일을 본 적이 있습니까? 인덱스 중 일부가 중간에있는 것처럼 보이므로 전혀 이해가되지 않습니다.
내 수준을 렌더링하는 데 사용하는 기능입니다.
void WLD::renderIntermediate(GLuint* textures, long curRegion, CFrustum cfrustum)
{
// Iterate through all of the regions in the PVS
for(int i = 0; i < regions[curRegion].visibility.size(); i++)
{
// Grab a visible region
int vis = regions[curRegion].visibility[i];
// Make sure it points to a mesh
if(regions[vis].meshptr == NULL)
continue;
// Make sure it is in our PVS
if(!cfrustum.BoxInFrustum(regions[vis].meshptr->minX, regions[vis].meshptr->minY, regions[vis].meshptr->minZ, regions[vis].meshptr->maxX, regions[vis].meshptr->maxY, regions[vis].meshptr->maxZ))
continue;
// Optional: Only render the region we are in (for testing)
//if(vis != curRegion)
// continue;
// Now find the ID of the zone mesh in the array
int id = regions[vis].meshptr->id;
// Figure out how many calls we will have to do to render it (different textures)
int calls = zmeshes[id].numPolyTex;
int count = 0;
// Render each call in batches
for(int j = 0; j < calls; j++)
{
// Bind the correct texture
glBindTexture(GL_TEXTURE_2D, textures[zmeshes[id].polyTexs[j].texIndex]);
// Set up rendering states
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
errorLog.writeSuccess("Drawing debug: ID: %i - Min: %i - Max: %i - Polys in this call %i - Count: %i - Location: %i", id, zmeshes[id].minmax[j].min, zmeshes[id].minmax[j].max, zmeshes[id].polyTexs[j].polyCount, zmeshes[id].polyTexs[j].polyCount * 3, count);
glVertexPointer(3, GL_FLOAT, sizeof(Vertex), &zmeshes[id].vertices[0].x);
glTexCoordPointer(2, GL_FLOAT, sizeof(Vertex), &zmeshes[id].vertices[0].u);
// Draw
glDrawRangeElements(GL_TRIANGLES, zmeshes[id].minmax[j].min, zmeshes[id].minmax[j].max, zmeshes[id].polyTexs[j].polyCount * 3, GL_UNSIGNED_SHORT, zmeshes[id].indices + count);
// End of rendering - disable states
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
// Add the number of indices rendered
count += zmeshes[id].polyTexs[j].polyCount * 3;
}
}
}
필자는 최소/최대 값이 올바르게 설정되었음을 나타내는 많은 디버그 정보를 작성했습니다. 이 시점에서 인덱스에 오류가있을 수 있으므로이 기능을 다시 살펴보고 다시 작성하겠습니다.
좋아요, 마치 원점 (0, 0, 0)에서 모두 합병되는 것처럼 보입니다. 믿기지 않을 정도로 기괴한. 누구든지 어떤 제안이 있습니까? –