Jump to content
  • Advertisement

Archived

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

CpMan

IndexBuffers: unusual problem (Formerly: "Driver Problem or What")

This topic is 5885 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Thanks for reading this post. Basically I have a really wierd problem with index buffers. In my terrain engine, I origionally built the engine to use simple vertex buffers, but I indexed all the vertices in the heightfield to save memory. Later I realized that it would be very simple to convert to index buffers, so I simply created an index buffer, did a little work, and I had my indexed primitives working, or so I thought. Instead of drawing the triangles as they are supposed to be, it draws them very wierd. Basically I think that DrawIndexedPrimitive is thinking that I am alternating my indices from the correct index to zero. So if the quad was supposed to be say 1,2,3 3,1,2 where the numbers are indices, D3D8 is thinking that I am saying 1,0,3 0,1,0 and so on. So when I run, all the vertices share a single point. After a large amount of debugging, I have eliminated the possibility that it is my engine, as checking the vertex and index buffers right before drawing reveals only a correct dataset, and I'm drawing D3D primitive type TRIANGLELIST. I'm wondering now whether it is the drivers of my video card, which is a nVidia Vanta with Detonator drivers. Otherwise, what else might it be? Edited by - CpMan on September 26, 2001 7:58:20 PM Edited by - CpMan on September 27, 2001 11:57:31 AM

Share this post


Link to post
Share on other sites
Advertisement
Well, this could be a really stupid suggestion, but did you remember that in C++ the arrays start at 0?

It happened to me when I started programming C++ (I was first programming in freepascal), so when I used D3D, my triangles kept having a point at screen(0,0), even though I had given them no such point. Turns out they used the fourth point (which didn''t exist of course), since I used the array at [3].

Share this post


Link to post
Share on other sites
No, that isn''t the case. And no matter how I mess with the index bases in DrawIndexedPrimtive, it still comes out the same.

Share this post


Link to post
Share on other sites
another stupid question CPMan, but what NVidia drivers do you have??

I''ve had nothing but problems since I upgraded to the new 21.xx drivers, and so I was forced to go back to the 12.41 ones...and everything works fine..

Do you have any code you could post/mail??

Wazoo

Share this post


Link to post
Share on other sites
nVidia drivers are the new Detonator XP (downloaded yesterday and nothing changed in my program). I''ll post code when I get home. On further checking of the code, I locked both the vertex and index buffers and went through the index buffer index by index. I then took the index and matched it with the vertex it corresponded to in the vertex buffer. Everything checked out. So now I don''t know what to do. I''ve never seen anything like it.

Share this post


Link to post
Share on other sites
Here''s the code, step by step. I hope its easy to read.


First the quadtree node structure, the quad structure, and all the other goodies

struct sQuad
{
int m_nTL;
int m_nTR;
int m_nBL;///indices of an aray
int m_nBR;
sQuad(int par_nTL, int par_nTR, int par_nBL, int par_nBR);
sQuad();
};

enum eVISIBILITY
{
LOC_FULL,
LOC_PARTIAL,
LOC_NONE,
LOC_UNCALC //uncalculated
};

struct sQuadTree
{
//these members are pointers in order so that the vertices that share
//values with there parents don''t eat up extra memory
int m_pTL; //top left member index into m_vField
int m_pTR; //top right member //quad members index into m_vField
int m_pBL; //bottom left member //(in world space coordinates)
int m_pBR; //bottom right member //although can be translated if needed

sP3D* m_pM; //middle middle point index into m_vField
sP3D* m_pLM; //middle point, left side index into m_vField
sP3D* m_pRM; //middle point, right side index into m_vField
sP3D* m_pTM; //middle point, top side index into m_vField
sP3D* m_pBM; //middle point, bottom side index into m_vField

//now the pointers to the children of theis node LOD operations//

sQuadTree* m_pParentQuad; //pointer to parent
//(will be NULL if this node is the head)
sQuadTree* m_pTLC; //top left child quad
sQuadTree* m_pTRC; //top right child these are all siblings
sQuadTree* m_pBLC; //bottom left child
sQuadTree* m_pBRC; //bottom right child

//now we have an array of 12 vertex dependencies
void* m_pVertexDep[12]; //vertex dependencies void pointers

//now comes optionally used information about the color information
//for the vertices

bool m_bUsePreColorDiffuse; //use a diffuse color component or not
//will be false if a normal is used
bool m_bUsePreColorSpecular; //use a specular color component or not
//like diffuse, will be false if normal
//is being used

//now the actual color information
//uses pointers, they will be NULL if normal is used or vice-versa

sC3D* m_pTLDiffuse; //diffuse color component (for top left)
sC3D* m_pTRDiffuse; //diffuse color component (for top right)
sC3D* m_pBLDiffuse; //diffuse color component (for bottom left)
sC3D* m_pBRDiffuse; //diffuse color component (for bottom right)
sC3D* m_pTLSpecular; //specular color component (for top left)
sC3D* m_pTRSpecular; //specular color component (for top right)
sC3D* m_pBLSpecular; //specular color component (for bottom left)
sC3D* m_pBRSpecular; //specular color component (for bottom right)


bool m_bTLOn; //is this vertex ON or OFF
bool m_bTROn; //is this vertex ON or OFF
bool m_bBLOn; //is this vertex ON or OFF
bool m_bBROn; //is this vertex ON or OFF

bool m_bProcessed; //has this block been processed yet

eVISIBILITY m_eFustrum; //is this block totally in the fustrum,
//partially, or not at all

sQuadTree(cTerrainManager &par_cTerrain); //default constructor

sQuadTree(cTerrainManager &par_cTerrain, int* pTL, int* pTR,
int* pBL, int* pBR, int* pM,
sQuadTree* pParentQuad,
sQuadTree* pTLC, sQuadTree* pTRC,
sQuadTree* pBLC, sQuadTree* pBRC); //other contructor
};

This function simply is the outline for the intialization of the terrain system at first.

bool cTerrainManager::CreateIntialDataset(mat44 par_matView, string par_TerrainFile = "")
{
//this function does all the intialization for the intial run, file work,
//etc.
//variables BEGIN//
sV3D temp;
bool loc_bResult; //result of any given function
vector loc_vHeightField; //terrain heightfield
//variables END////

loc_vHeightField.reserve(10000);
if(par_TerrainFile != "")
{
m_TerrainName = par_TerrainFile; //set terrain fiel name
}
loc_vHeightField = ReadTerrainFile(); //call the function to read the
//terrain fiel and contruct the
//vertex grid\
temp = loc_vHeightField[11];
if(loc_vHeightField.size() < 4) //test whether heightfield was able to
//be read
{
return false; //heightfield could not be read (size of heightfield)
//returned was one or less
}

else
{
m_mField.reserve(10000);
m_mField = loc_vHeightField; //set heightfield
}

loc_vHeightField.resize(0);
//now prepare the vertex buffer



if(!m_lpDevice)
{
return false;
}
if(m_LightingParams->m_bUseAutomatic)
{
if(FAILED(m_lpDevice->CreateVertexBuffer(sizeof(sTLV3D)*15000,
D3DUSAGE_SOFTWAREPROCESSING | D3DUSAGE_WRITEONLY,
D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1,
D3DPOOL_DEFAULT, &m_lpVertexBuffer)))
{
return false; //vertex buffer creation failed
}
if(FAILED(m_lpDevice->CreateIndexBuffer(sizeof(sV3D)*(2 *m_nFieldWidth*m_nFieldWidth-(4*m_nFieldWidth)+1000),
D3DUSAGE_WRITEONLY | D3DUSAGE_SOFTWAREPROCESSING, D3DFMT_INDEX32, D3DPOOL_DEFAULT,
&m_lpIndexBuffer)))
{
return false; //could not create index buffer
}
}
else
{
if(FAILED(m_lpDevice->CreateVertexBuffer(sizeof(sV3D)*m_mField.size(),
D3DUSAGE_SOFTWAREPROCESSING | D3DUSAGE_WRITEONLY,
D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1,
D3DPOOL_DEFAULT, &m_lpVertexBuffer)))
{
return false; //vertex buffer creation failed
}
if(FAILED(m_lpDevice->CreateIndexBuffer(sizeof(sV3D)*(2*m_mField.size()-(4 *m_nFieldWidth)),
D3DUSAGE_WRITEONLY | D3DUSAGE_SOFTWAREPROCESSING, D3DFMT_INDEX16, D3DPOOL_DEFAULT,
&m_lpIndexBuffer)))
{
return false; //could not create index buffer
}
}

//now prepare the texture coordinates//
GenerateTextureCoords(); //generate tex coords
//////



loc_bResult = ConstructQuadTree(loc_vHeightField); //attempt to construct
//the quadtree
if(!loc_bResult)
{
return false; //quadtree could not be constructed
}


loc_bResult = SetVertexDependencies();
//set up the vertex dependencies


if(!loc_bResult)
{
return false; //vertex dependecies could not be successfully set
}

loc_bResult = GenerateLighting(loc_vHeightField); //generate the lighting
if(!loc_bResult)
{
return false; //lighting failed
}


FillVertexBuffer(); //fill the vertex buffer with the vertex information

loc_bResult = Update(par_matView); //attempt to update the stacks
//for a frame (intial)
if(!loc_bResult)
{
return false; //frame update failed
}


//before we end, free up any memory used by the heightfield
loc_vHeightField.resize(0);
return true; //all was good
}

This function outlines the updating of the dataset that I draw. It uses a quadtree and LOD, althought the LOD is not working as of right now (that doesn''t matter as that was the case in the previous vertex buffer only system and it worked fine).

bool cTerrainManager::Update(mat44 &par_matView)
{
m_matViewMatrix = par_matView; //update the view

//first reset the tree
//ResetTree();
//then get the frustum planes
CreateFrustum();
//then the vector

long temp = m_DrawVector.size();
m_DrawVector.clear();
m_DrawVector.reserve(2*m_nFieldWidth*m_nFieldWidth-(4*m_nFieldWidth)+1000);
m_nCurrIndex = 0;

//then upadte the tree
if(UpdateDataset(&par_matView))
{
//finally test for intersection with other objects and update the drawqueue
UpdateQueue(); //queue is actually a vector
UpdateVertexBuffer(); //update index buffer, yes, index buffer
}
return true; //all is good
}

The function FillVertexbuffer copies the verteices to the vertex buffer

void cTerrainManager::FillVertexBuffer()
{
sV3D* loc_pLockItem; //item that passes data to the vertex buffer
sTLV3D* loc_pLockItemTrans; //item that passes data to the vertex buffer
sV3D loc_vTemp; //temporary vertex
sTLV3D loc_vTempTrans; //temporary vertex(Transformed)
int i;
//variables END////
if(!m_lpDevice)
{
return; //invalid device
}
if(m_LightingParams->m_bUseNormals)
{
m_nNumVertices = m_mField.size();
//now lock the buffer
m_lpVertexBuffer->Lock(0,sizeof(m_mField), (BYTE**)&loc_pLockItem, D3DLOCK_DISCARD);
//memcpy(loc_pLockItem,(void*)&m_mField,sizeof(m_mField));
for(i = 0; i < m_mField.size(); i++)
{
loc_pLockItem.location = m_mField[i].location;
loc_pLockItem[i].normal = m_mField[i].normal; //i''m using a for loop for ////debugging
loc_pLockItem[i].u = m_mField[i].u;
loc_pLockItem[i].v = m_mField[i].v;
}
}
else
{
m_nNumVertices = m_mField.size();
//now lock the buffer
m_lpVertexBuffer->Lock(0,0, (BYTE**)&loc_pLockItemTrans, D3DLOCK_DISCARD);
memcpy(loc_pLockItem,(void*)&m_mField,sizeof(m_mField));
}
m_lpVertexBuffer->Unlock();
}

Now the UpdateDataset function, and the TestFrustum function

bool cTerrainManager::UpdateDataset(mat44 *par_pmatNewView,
sQuadTree* par_pParent)
{

//first and foremost, make sure this block has not been processed


//variables BEGIN/
mat44 loc_matWorld; //temp world matrix
mat44 loc_matProjection; //temp Projection matrix
mat44 loc_matCamera; //temp Camera matrix
D3DVIEWPORT8 loc_vpViewPort; //temp viewport
sP3D loc_ptEnd1; //end point
sP3D loc_ptEnd2; //end point
int loc_nNumChecked=0; //number of parralled egdes that check out
int c; //loop var
//variables END///

//in this function, we update the stacks and determine what to draw
//first make sure theviewpoint has changed since last time.
if(!par_pParent)
{
//this function was called from the outside (assumed)
//we set the par_pParent to m_pTreeHead; and reset the tree
par_pParent = m_pTreeHead;
}
if(par_pParent->m_bProcessed)
{
return true; //block has already been processed, does not need
//further action taken upon it
}
par_pParent->m_bBLOn= false;
par_pParent->m_bBROn= false;
par_pParent->m_bTLOn= false;
par_pParent->m_bTROn= false;
par_pParent->m_eFustrum = LOC_UNCALC;

if(!par_pmatNewView && m_bValidStack)
{
//if a new viewpoint was not specified and the stack has been
//initialized//
return false; //nothing needs to be done
}
else
{
//in this part, we actually generate the vertices needed for the
//terrain
if(par_pParent->m_pParentQuad)
{
//firts make sure we actually have to test in the first place
if(par_pParent->m_pParentQuad->m_eFustrum == LOC_PARTIAL ||
par_pParent->m_pParentQuad->m_eFustrum == LOC_UNCALC)
{
//first-test against the fustrum
TestFustrum(par_pParent);
if(par_pParent->m_eFustrum == LOC_NONE)
{
//clean up
return true; //return from recursion of this branch since this
//can''t be seen
}
}
else
{

if(par_pParent->m_pParentQuad->m_eFustrum == LOC_NONE)
{
//if you can''t see any of this, we shouldn''t be on this brance
return true;
}
if(par_pParent->m_pParentQuad->m_eFustrum == LOC_FULL)
{
par_pParent->m_eFustrum = LOC_FULL; //set this one to full
}
}
}
else
{
TestFustrum(par_pParent);
if(par_pParent->m_eFustrum == LOC_NONE)
{
//clean up
return true; //return from recursion of this branch since this
//can''t be seen
}
}
//now that we''ve tested against the double fustrum, we can
//test for LOD
}
//first set these four vertices to be true. They will potentially be final
//if we don''t recurse

par_pParent->m_bBLOn = true;
par_pParent->m_bBROn = true;
par_pParent->m_bTLOn = true;
par_pParent->m_bTROn = true;

//then we update the vertex dependecies for these verts
//for(c = 0;c < 12; c++)
//{
// par_pParent->m_pVertexDep[c] = (bool*)true;
//}

//now we test the four edges

//first get the info we need(the three matrices
if(m_lpDevice)
{
m_lpDevice->GetTransform(D3DTS_WORLD, (D3DMATRIX*)&loc_matWorld);
m_lpDevice->GetTransform(D3DTS_PROJECTION, (D3DMATRIX*) &loc_matProjection);
m_lpDevice->GetTransform(D3DTS_VIEW, (D3DMATRIX*)&loc_matCamera);
m_lpDevice->GetViewport(&loc_vpViewPort);
}

//:middle point
if(par_pParent->m_pTLC && par_pParent->m_pBLC &&
par_pParent->m_pTRC && par_pParent->m_pBRC)
{
//test the length

//first what it is now
D3DXVec3Project((D3DXVECTOR3*)&loc_ptEnd1,
(D3DXVECTOR3*)&par_pParent->m_pM,
&loc_vpViewPort,
(D3DXMATRIX*)&loc_matProjection,
(D3DXMATRIX*)&loc_matCamera,
(D3DXMATRIX*)&loc_matWorld);
//then what it would be
D3DXVec3Project((D3DXVECTOR3*)&loc_ptEnd2,
(D3DXVECTOR3*)&m_mField[par_pParent->m_pTLC->m_pBR],
&loc_vpViewPort,
(D3DXMATRIX*)&loc_matProjection,
(D3DXMATRIX*)&loc_matCamera,
(D3DXMATRIX*)&loc_matWorld);
loc_ptEnd1.z = 0;
loc_ptEnd2.z = 0;
if(loc_ptEnd1.DistBtwnPoints(loc_ptEnd1,loc_ptEnd2) > m_nPivotSize)
{
//recurse...since this is the middle, we must recurse all four
UpdateDataset(par_pmatNewView,par_pParent->m_pTLC); //recurse
//the top left
//child

UpdateDataset(par_pmatNewView,par_pParent->m_pBLC); //recurse
//the bottom
//left
//child
UpdateDataset(par_pmatNewView,par_pParent->m_pTRC); //recurse
//the top left
//child

UpdateDataset(par_pmatNewView,par_pParent->m_pBRC); //recurse
//the bottom
//left
//child
return true; //all is done for this block, because all verts
//were tested
}
//there are other calls in Update Dataset below ths, but they are the same as above, only //they work with the edges and would lebgthen the post way too much if included
}
return true; //all was good
}

void cTerrainManager::TestFustrum(sQuadTree *par_quadBlock)
{
//TODO: inplement the 6 plane algorithm for trying to find out whether
//something is in the fustrum,

int loc_p;
int loc_c = 0;
float loc_d;
sP3D loc_points[4];
sP3D loc_center;
float loc_radius;

//first get the values we need
loc_points[0] = m_mField[par_quadBlock->m_pTR].location;
loc_points[1] = m_mField[par_quadBlock->m_pBR].location;
loc_points[2] = m_mField[par_quadBlock->m_pTL].location;
loc_points[3] = m_mField[par_quadBlock->m_pBL].location;
D3DXComputeBoundingSphere(&loc_points, 4, D3DFVF_XYZ, (D3DXVECTOR3*) &loc_center, &loc_radius);

for( loc_p = 0; loc_p < 6; loc_p++ )
{
loc_d = m_FrustumPlanes[loc_p].normal.x * loc_center.x + m_FrustumPlanes loc_p].normal.y * loc_center.y + m_FrustumPlanes[loc_p].normal.z * loc_center.z + m_FrustumPlanes[loc_p].distance;

if( loc_d <= -loc_radius )
{
par_quadBlock->m_eFustrum = LOC_NONE;
return;
}
if( loc_d > loc_radius )
{
loc_c++;
}
}
if(loc_c == 6)
{
par_quadBlock->m_eFustrum = LOC_FULL;
}
else
{
par_quadBlock->m_eFustrum = LOC_PARTIAL;
}
//par_quadBlock->m_eFustrum = LOC_FULL;
}

Now the UpdateQueue function simply adds the turned on vertices to an array and funally UpdateVertexBuffer Locks the index buffer and sticks the data in.

bool cTerrainManager::UpdateVertexBuffer()
{
//variables BEING//
UINT* loc_pLockItem; //item that passes data to the vertex buffer
sV3D* loc_pLockItemv; //item that passes data to the vertex buffer
int c=0; //counter
sV3D loc_vTemp; //temporary vertex
sTLV3D loc_vTempTrans; //temporary vertex(Transformed)
//variables END////
if(!m_lpDevice)
{
return false; //invalid device
}
if(m_DrawVector.size () < 3)
{
//nothing to draw,. but might be correct
return true;
}
m_nNumVertices = m_DrawVector.size();
//now lock the buffer
m_lpIndexBuffer->Lock(0,sizeof(m_DrawVector), (BYTE**)&loc_pLockItem, 0);
//memcpy(loc_pLockItem, (void*)&m_DrawVector, sizeof(m_DrawVector));
sP3D point;
sV3D vert;
for(c = 0;c < m_DrawVector.size(); c++)
{
point = m_mField[m_DrawVector[c]].location; //for loop for debugging
loc_pLockItem[c] = m_DrawVector[c];
}

m_lpIndexBuffer->Unlock();
return true;
}

now I''ll put in the draw function, this is whdere the problem comes in.

bool cTerrainManager::Draw()
{
if(!m_lpDevice)
{
return false;
}
if(m_LightingParams->m_bUseNormals)
{
m_lpDevice->SetRenderState(D3DRS_ZENABLE, FALSE); ///set z buffering to ///true
m_lpDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); ///set z buffering to ///true
m_lpDevice->SetVertexShader(D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1);
m_lpDevice->SetStreamSource(0, m_lpVertexBuffer, sizeof(sV3D));
m_lpDevice->SetIndices(m_lpIndexBuffer, 0);
}
else
{
m_lpDevice->SetRenderState(D3DRS_ZENABLE, TRUE); ///set z buffering to ///true
m_lpDevice->SetVertexShader(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
m_lpDevice->SetStreamSource(0, m_lpVertexBuffer, sizeof(sTLV3D));
m_lpDevice->SetIndices(m_lpIndexBuffer, 0);
}


//RIGHT HERE THE VERTEX BUFFER AND INDEXBUFFERS ARE TOTALLY CORRECT
//TO CHECK THIS, I LOCKED BOTH THE VERTEX AND INDEX BUFFERS AND STEPPED //THROUGH THE INDEX BUFFER, INDICE BY INDICE AND MATCHED IT WITH THE //VERTEX IT CORRESPONDED TO FROM THE VERTEX BUFFER. iT CHECKS OUT //ENTIRELY
if(FAILED(m_lpDevice->BeginScene()))
{
return false; //could not begin the scene
}
if(FAILED(m_lpDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0,
m_mField.size(), 0, (m_DrawVector.size())/3 )))
{
return false; //drawing failed
}
if(FAILED(m_lpDevice->EndScene()))
{
return false;
}
return true;
}

SOME OTHER THINGS TO NOTE. FOR SOME ODD REASON, WHEN CULLING IS TURNED OFF, THE FOUR CORNED OF EACH QUAD OF THE QUADTREE APPEAR, BUT THE DIAGONAL, WHICH IS SUPPOSED TO GO FROM ONE CORNER TO ANOTHER INSTEAD GOES FROM ONE CORNER TO THE ORIGIN 0,0 ( ALSO THE FIRST VERTEX IN THE VERTEX BUFFER). IN ADDITION, THE VIEW CULLING IS ALSO FAULTY NOW THAT I AM USING INDEX BUFFERS. INSTEAD OF RENDERING EVERYTHING THAT IS IN THE VIEW FRUSTUM, IT RENDERS ONLY THE BOTTOM HALF OF THE HEIGHTFIELD, AND AS YOU PASS OVER WHAT WOULD BE THE TOP HALF OF THE HEIGHTFIELD, IT SUDDENLY SHOWS IT JUST AS ITS PASSING OUT OF VIEW. SORRY IF THAT''S HARD TO UNDERSTAND. AS I SAID, THIS IS SIMPLY A CONVERSION FROM VERTEX BUFFER TO INDEX BUFFER, AND IT WAS VERY SIMPLE. ORIGINALLY, INDICES WERE USED AS DATA MEMBERS TO DEFINE THE FOUR CORNERS OF THE QUADTREE. THESE INDICES SIMPLY INDEXED INTO A HEIGHTFIELD VECTOR TO SAVE SPACE. SWITCHING TO INDEX BUFFERS ONLY REQUIRED ADDING THE INDEX BUFFER, AND USING THE INDICES THAT DEFINE EACH QUAD AS DATA (IN THE INDEX BUFFER) RATHER THAN PUTTING WHAT THEY REPRESENT IN THE VERTEX BUFFER. IN OTHER WORDS, IT WAS THE DIFFERENCE BETWEEN
VERTEXBUFFER[C] = HEIGHTFIELD[QUAD_INDICE];
AND
INDEXBUFFER[C] = QUAD_INDEX.

Share this post


Link to post
Share on other sites
Upon further testing, I also noticed that sometimes the "rougue" lines will change directions suddenly and go another way. Hope this helps.

Share this post


Link to post
Share on other sites
Sounds funny but i have come to the same problem.
I used for testing purposes just one quad:

1----3
|\ |
| \ |
| \ |
| \|
0----2

it looks like this or better it should look like this.
when i darw the quad using just the vertexbuffer i do it by
defining the vertices in the 0,1,2,3,2,1 order. (I know that i could use TRIANGLESTRIP instead of TRINAGLELIST but i want to compare)
then i create an index buffer with 0,1,2,3,2,1 order and define
my vertices as 0,1,2,3
then i call DrawIndexPrimitive with format TRIANGLELIST
and two Polys. I get as result two Polys just as is requested
but they look like this 0,1,2 (which is the correct one) and
3,2,0 (which is wrong) i tried to increase the Polycount but i always get such wierd results. The funny thing is: when i tell the CreateIndexBuffer function that i want just the Space for one Poly (which results in a crash at the end of the programm)
then the Quad is drawn perfectly. Is this some issue of DX or what is the problem here?

By CommanderXXL

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
aaah - i also had the same problem, but the problem wasn''t the drivers or anything - more a presumption.

If you are using INTs to store the index of each vertex (ie, in the index buffer), then you need to make that index buffer store 32 bit values (pass it D3DFMT_INDEX32 when you make it) - then it will work.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!