I'm making a 2D game that uses directx. Currently, I have a background texture (with more to come) that I draw to the screen. However, I only want a portion of the texture drawn to the screen. I know that I could use a rectangle with the draw function, but I need a greater degree of control. Is there a way to draw several triangles (using custom vertices) to the screen from my drawing? I've looked around the internet and this site, but I just can't seem to find what I want. I can give more information/code if needed. Thank you!
Asked
Active
Viewed 584 times
0
-
Are you familiar with the use of shaders? – Tiago Costa Jun 11 '12 at 15:40
-
I have heard of them but have never used them. Would they help? Any good tutorials? – Ryan K Jun 11 '12 at 15:48
-
You can define a list or strip of triangles with the appropriate texture coordinates. If you don't specify texcoords in [0,1], but in e.g. [0.25, 0.75], then only the center of the texture will be drawn on the patch. Where exactly is your problem? – Nico Schertler Jun 11 '12 at 21:32
-
My problem is sprite::draw takes a rectangle object and I want triangles. I found a few pages on the toymaker.info website about rendering 3D primitives in 2D. I'm going to check that out, but I'm not sure if that is the correct way to do it. – Ryan K Jun 11 '12 at 23:12