As coincidence would have it, I just modified this in the open-source code (my own copy) for DarkGDK/DBPro earlier today, and then happened across your thread here. I converted the function that creates planes from doing a 6 vertex triangle list to a 4 vertex triangle strip. According to MSDN, triangle fans are deprecated in DirectX 10, so I went with the strip. And the planes are created correctly with this code (I tested it in DarkGDK).
Here's the new function (with the old code commented-out). It is located in the source file is DBOMesh.cpp
DARKSDK_DLL bool MakeMeshPlain ( bool bCreateNew, sMesh* pMesh, float fWidth, float fHeight, DWORD dwFVF, DWORD dwColor )
{
// create memory
DWORD dwVertexCount = 4; // store number of vertices (was 6 PMC)
DWORD dwIndexCount = 0; // store number of indices
if ( !SetupMeshFVFData ( pMesh, D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1, dwVertexCount, dwIndexCount ) )
{
RunTimeError ( RUNTIMEERROR_B3DMESHLOADFAILED );
return false;
}
/*
// leefix-210703-corrected UV coords of plain ( they where -1.0f, etc?? )
// and DBPro rotates it Y=180 so it faces the camera (for compatibility and correct plain)
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 0, -fWidth, fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 1.0f, 0.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 1, fWidth, fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 0.0f, 0.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 2, -fWidth, -fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 1.0f, 1.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 3, fWidth, fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 0.0f, 0.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 4, fWidth, -fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 0.0f, 1.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 5, -fWidth, -fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 1.0f, 1.0f );
// setup mesh drawing properties
pMesh->iPrimitiveType = D3DPT_TRIANGLELIST;
*/
// PMC - converted from 6 vertices to 4 (more efficient) - Also corrected texture orientation so they're no longer rendered backwards.
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 0, -fWidth, -fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 0.0f, 1.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 1, -fWidth, fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 0.0f, 0.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 2, fWidth, -fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 1.0f, 1.0f );
SetupStandardVertex ( pMesh->dwFVF, pMesh->pVertexData, 3, fWidth, fHeight, 0.0f, 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB ( 255, 255, 255, 255 ), 1.0f, 0.0f );
// setup mesh drawing properties
pMesh->iPrimitiveType = D3DPT_TRIANGLESTRIP;
pMesh->iDrawVertexCount = pMesh->dwVertexCount;
pMesh->iDrawPrimitives = 2;
// okay
return true;
}
P.S. fWidth and fHeight were halved prior to this function call.
(they've used lots of wrapper functions - no doubt from doing a quick merging of the DarkGDK with the DBPro code).
For Reference on triangles/primitives (visit the links in the Remarks section):
http://msdn.microsoft.com/en-us/library/windows/desktop/bb172589%28v=vs.85%29.aspx
Edit - December 18, 2013: I just made a modification to the 4-vertex plane creation function. There's been a bug since forever where planes rendered textures backwards. So I inverted the tu values to correct it. The tu values are the second float value from the end.
Q: ...you mean computer imagery was still based on the paradigm that the world was flat? Even into the 21st century??? Talk about doing something the hard way!
A: Yep! Back then people would render simple shapes with complex meshes of thousands of flat little triangles. Next to the bottleneck processors they used, it's the main reason why their computers were so slow. In the last days of the religious atmosphere of centralization and trade, corporate dogmas had people believing that flat was faster.