glDrawElements和DrawIndexedPrimitive
opengl和d3d精通的大哥来帮忙把这句话翻译成d3d的:
// Render our current face to the screen with vertex arrays
glDrawElements(GL_TRIANGLES, pFace->numOfIndices, GL_UNSIGNED_INT, &(m_pIndices[pFace->startIndex]) );
其中pface的结构定义如下:
struct tBSPFace
{
int textureID;// The index into the texture array
int effect;// The index for the effects (or -1 = n/a)
int type;// 1=polygon, 2=patch, 3=mesh, 4=billboard
int startVertIndex;// The starting index into this face's first vertex
int numOfVerts;// The number of vertices for this face
int startIndex;// The starting index into the indices array for this face
int numOfIndices;// The number of indices for this face
int lightmapID;// The texture index for the lightmap
int lMapCorner[2];// The face's lightmap corner in the image
int lMapSize[2];// The size of the lightmap section
CVector3 lMapPos;// The 3D origin of lightmap.
CVector3 lMapVecs[2];// The 3D space for s and t unit vectors.
CVector3 vNormal;// The face normal.
int size[2];// The bezier patch dimensions.
};
我试着写了几个都不正常,pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, pFace->startVertexIndex,
//pFace->totalVertices / 2);可以渲染部分正常,但是如果地图中有使用布尔物体做的就会有问题,所以我准备用DrawIndexedPrimitive或者DrawIndexedPrimitiveUP来渲染,但是参数不知怎么填。。是不是还要setindex?所以我就想把opengl的这句代码原型不动的翻译成d3d的
[解决办法]
恭喜楼主,只能接分了,呵呵 :]
[解决办法]
呵呵,先思考,后动手.再求救.
[解决办法]
恭喜楼主,只能接分了,呵呵 :]