I try to draw the sphere with a texture on it, pretty simple
In order to draw a texture you need uv's 'TEXCOORD', a 'float2'
but when i try to draw my simple little sphere it keeps telling me TEXCOORD0 doesn't correspond with the current vertex declaration
which im pretty sure the vertex declaration for these premade meshes is
POSITION NORMAL TEXCOORD COLOR
ive used TEXCOORD0 with a sphere several times and it worked
what could be causing this error, i dont know how long i've been trying to figure this out. Maybe i'm not initializing something write when i initialize D3D?
This is what my code looks like
// HLSL
struct VS_INPUT
{
float3 untransformed_pos : POSITION0;
float2 uv : TEXCOORD0;
};
// C++
ID3DXMesh *mesh;
IDirect3DTexture9 *texture;
ID3DXEffect *shader;
// Load the spere mesh in, and the texture
D3DXCreateSphere(d3dDevice,.5f,30,30,&mesh,nullptr);
D3DXCreateTextureFromFileA(d3dDevice,"sun.png",&texture);
unsigned passes(0);
shader->Begin(&passes,0);
for(unsigned i = 0;i < passes;++i)
{
shader->BeginPass(i);
shader->SetMatrix(gWorldViewProjection,&(Transform*Camera*proj));
shader->SetTexture(gTexture,texture);
shader->CommitChanges();
mesh->DrawSubset(0);
shader->EndPass();
}
shader->End();
// I don't know what's wrong
Edited by Muzzy A, 23 May 2012 - 04:59 AM.






