#### Archived

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

# Texturing Problem

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

## Recommended Posts

Hello! I am making a simple 2d particle effect in D3D. I have a vertex Buffer which I put the particle vertex into. Then I have an index buffer which I use to index the vertex to make a square. Then I draw it. It draws the triangles correctly and make the square but the texture is not drawn onto it propperly. It textures the whole square with just the top left pixel of the texture. So I know that the texture is loaded propperly but not being put onto the square correctly. I have tried to work out what is wrong with it and can''t seem to see what is broken. Here is the code I use to build my triangles.
//Add the 4 Vertex that make the quad to the Vertex Buffer

//(0,0)
pVertices->Color = Particles[Count].StartColor;
pVertices->Position = D3DXVECTOR3(Particles[Count].Position.x - (Particles[Count].Size/2.0f), Particles[Count].Position.y - (Particles[Count].Size/2.0f), 0.0);
pVertices->rhw = 0.0f;
pVertices->tu = 0.0f;
pVertices->tv = 0.0f;
pVertices++;

//(1,0)
pVertices->Color = Particles[Count].StartColor;
pVertices->Position = D3DXVECTOR3(Particles[Count].Position.x + (Particles[Count].Size/2.0f), Particles[Count].Position.y - (Particles[Count].Size/2.0f), 0.0);
pVertices->rhw = 0.0f;
pVertices->tu = 1.0f;
pVertices->tv = 0.0f;
pVertices++;

//(0,1)
pVertices->Color = Particles[Count].StartColor;
pVertices->Position = D3DXVECTOR3(Particles[Count].Position.x - (Particles[Count].Size/2.0f), Particles[Count].Position.y + (Particles[Count].Size/2.0f), 0.0);
pVertices->rhw = 0.0f;
pVertices->tu = 0.0f;
pVertices->tv = 1.0f;
pVertices++;

//(1,1)
pVertices->Color = Particles[Count].StartColor;
pVertices->Position = D3DXVECTOR3(Particles[Count].Position.x + (Particles[Count].Size/2.0f), Particles[Count].Position.y + (Particles[Count].Size/2.0f), 0.0);
pVertices->rhw = 0.0f;
pVertices->tu = 1.0f;
pVertices->tv = 1.0f;
pVertices++;

//Add to Index Buffer to make the 2 triangles

*(pIndices) = 2+(ParticlesCached*4);
*(pIndices)++;

*(pIndices) = (ParticlesCached*4);
*(pIndices)++;

*(pIndices) = 3+(ParticlesCached*4);
*(pIndices)++;

*(pIndices) = 3+(ParticlesCached*4);
*(pIndices)++;

*(pIndices) = (ParticlesCached*4);
*(pIndices)++;

*(pIndices) = 1+(ParticlesCached*4);
*(pIndices)++;

Thank you for any help.

##### Share on other sites
I have not changed them at all and the sdk says they are default settings so it should not be that?

1. 1
2. 2
3. 3
4. 4
Rutin
13
5. 5

• 12
• 15
• 9
• 14
• 10
• ### Forum Statistics

• Total Topics
632655
• Total Posts
3007675
• ### Who's Online (See full list)

There are no registered users currently online

×