Jump to content
  • Advertisement
Sign in to follow this  
Kurt-olsson

Make texture fit triangle?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

i render alot of triangles and now i load them with a texture instead of just color and alpha.
it works with both alpha and textures.

but my problem is that there are multiple textures on each triangle. Is there a way i can scale this?
so the texture is bigger and covers more of the triangle?

this is how i render my triangles:

[source lang="java"]d3ddev->SetTexture( 0, g_pTexture );
d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
if (texture)
d3ddev->SetFVF(VERTEX_FORMAT_TEXTURE);
else
d3ddev->SetFVF(VERTEX_FORMAT_NO_TEXTURE);
d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, (lstTrangles.size()*3));
[/source]

Share this post


Link to post
Share on other sites
Advertisement
Generally you manage this through your texcoords. So if you want a texture to stretch over many triangles, you set the texcoords so that the will only use the area that is necessary for them. You texcoords specify how much of the texture you want the triangle to receive.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!