그런데.. 제가 만들려고 하는게 한 화면에 전체를 볼수도 있는 툴이라서요..ㅠㅠ 버텍스버퍼에는 x,y,z 좌표와 u,v 좌표를 가지고 있습니다. 버텍스와 인덱스 모두 STL로 저장시켰구요. 즉, 사각형 하나당 버텍스 4개, 인덱스 6개씩 STL로 연결되어있습니다.
for (int x = 0; x<m_MapWidth; x++)
{
for ( int z = 0; z < m_MapHeight; z ++)
{
// x, y, z, u, v
m_MapVertexList.push_back((float)x, 0.0f, (float)z+1.0f), 0.0f, 0.0f);
m_MapVertexList.push_back((float)x+1.0f, 0.0f,(float)z+1.0f),1.0f/16,0.0f);
m_MapVertexList.push_back((float)x, 0.0f,(float)z),0.0f,1.0f/8);
m_MapVertexList.push_back((float)x+1.0f, 0.0f,(float)),1.0f/16,1.0f/8);
m_MapIndexList.push_back(index);
m_MapIndexList.push_back(index+1);
m_MapIndexList.push_back(index+2);
m_MapIndexList.push_back(index+1);
m_MapIndexList.push_back(index+3);
m_MapIndexList.push_back(index+2);
index += 4;
}
}
// 맵 버텍스
m_pd3dDevice->CreateVertexBuffer( m_MapWidth*m_MapHeight*4*sizeof(TITAN_MAPVERTEX),0,TITAN_MAPVERTEX::FVF,
D3DPOOL_MANAGED, &m_pMapVB, NULL);
VOID* pVertices;
m_pMapVB->Lock( 0, m_MapWidth*m_MapHeight*4*sizeof(TITAN_MAPVERTEX),(void**)&pVertices, 0);
memcpy(pVertices,m_MapVertexList.begin(), m_MapWidth*m_MapHeight*4*sizeof(TITAN_MAPVERTEX));
m_pMapVB->Unlock();
// 맵 인덱스
m_pd3dDevice->CreateIndexBuffer( m_MapWidth*m_MapHeight*6*sizeof(WORD),0, D3DFMT_INDEX16, D3DPOOL_MANAGED,
&m_pMapIB, NULL );
VOID* pIndices;
m_pMapIB->Lock(0, m_MapWidth*m_MapHeight*6*sizeof(WORD), (void**)&pIndices,0 );
memcpy(pIndices, m_MapIndexList.begin(), m_MapWidth*m_MapHeight*6*sizeof(WORD));
m_pMapIB->Unlock();
대충 요약하면 이렇습니다.
혹시 LOCK걸고 memcpy하는 쪽에서도 몇만개이상은 안된다던가 하는게 있는건지,.. 헬프문서 뒤져봐도 그런얘기가 없네요.-_-