Sign in to follow this  
RaisedByWolves

DrawPrimitive Messing up textures

Recommended Posts

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[i] ); g_d3d_device->SetTexture( 0, Target->Textures[i] ); 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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this