ive followed Reimers "Adding Some Color And The Z-Buffer" tutorial and its not working.
the D3D debug runtime only complains about "WRITEONLY" not being set for the vertex buffer on creation.
my code is almoast identical to his terrain rendering section.
ive enabled the depth-stencil buffer, the tiger model from the SDK "meshes" tutorial renders correctly( a bit pixelated ), but the terrain is completely white.
the diffuse colour of the "OURCUSTOMVERTEX" struct looks to be correctly, but the terrain is completely white.
here is the diffuse colour setting code:
if (height < MinimumHeight + (MaximumHeight - MinimumHeight) /4) //new
cv_Vertices[y*WIDTH + x].color = 0xff0000ff;
else if (height < MinimumHeight + (MaximumHeight - MinimumHeight) * 2/4)
cv_Vertices[y*WIDTH + x].color = 0xff228b22;
else if (height < MinimumHeight + (MaximumHeight - MinimumHeight) * 3/4)
cv_Vertices[y*WIDTH + x].color = 0xffa52a2a;
else
cv_Vertices[y*WIDTH + x].color = 0xffffffff;
adn rendering code:
Device->SetStreamSource( 0, VertexBuffer, 0, sizeof( OURCUSTOMVERTEX ) );
Device->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE );
Device->SetIndices( IndexBuffer );
D3DXMATRIX matWorld;
D3DXMATRIX matTranslation;
D3DXMATRIX matRotation;
D3DXMatrixTranslation( &matTranslation, xPos, yPos, zPos );
D3DXMatrixRotationYawPitchRoll( &matRotation, DegreeToRadian( 0 ), DegreeToRadian( 180 ), DegreeToRadian( 0 ) );
matWorld = matRotation * matTranslation;
Device->SetTransform( D3DTS_WORLD, &matWorld );
Device->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, WIDTH * HEIGHT, 0,( WIDTH - 1 ) * ( HEIGHT - 1 ) * 2 );
Thanks In Advance.