DrawPrimitive Messing up textures
I'm working on something that uses two different methods to draw meshes.
Here are some excerpts
One:
D3DXMatrixTranslation(&matPos, xpos, 0.0, zpos);
g_d3d_device->SetTransform(D3DTS_WORLD,&matPos);
D3DXMatrixScaling(&matPos, xsize, 1.0, zsize);
g_d3d_device->MultiplyTransform(D3DTS_WORLD,&matPos);
g_d3d_device->SetStreamSource(0,floor_vb,0,sizeof(mesh_vertex));
g_d3d_device->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
and Two:
g_d3d_device->SetMaterial( &Target->Materials );
g_d3d_device->SetTexture( 0, Target->Textures );
Target->TheMesh->DrawSubset(i);
My problem is that whenever I use the second method, it screws something up and the textures are messed up for objects drawn with the first method. I've narrowed it down to the DrawSubset line. When that is commented out, the textures are still good for objects drawn with the first method.
Any one familiar with this? I'm thinking DrawSubset does some sort of texture scaling or something that remains when I try the DrawPrimitive.
Thanks,
~Raised
I guess you also have to set other states like the texture cascade. Check the SetTextureStageState for more information. I suggest checking some texturing tutorials.
Luck!
Guimo
Luck!
Guimo
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement