mikegi
01-17-2004, 08:03 PM
I want to draw a long, thin triangle where one side has a 1d texture, the other side has a different 1d texture, and the interior is a bilinear interpolation of the two.
Right now I'm simply walking out along the triangle drawing quads for each sample. It works and is surprisingly quick but uses tons of memory. For example, one scene has 920 samples per 1d texture and I need to draw 600 triangles. Even after eliminating blank samples, it still needs 709,000 vertices.
I'm wondering if a fragment program could eliminate all these quads and associated memory usage. What I'd like to do is have a 2x1024 texture, put the samples for one side of the triangle in row 0 and the samples for the other side in row 1. I draw a triangle with texCoords of 0,0 - 1,0 - 1,1 then have my fragment program dork with fragment texture coordinates (x,y are the incoming texCoords to the FP):
x' = x
y' = y / x
I use these new coordinates to look up my color in the 2x1024 texture. Essentially, I'm trying to pinch a quad into a triangle while maintaining the quad's interpolation.
Is this possible with a fragment program?
Thanks
Right now I'm simply walking out along the triangle drawing quads for each sample. It works and is surprisingly quick but uses tons of memory. For example, one scene has 920 samples per 1d texture and I need to draw 600 triangles. Even after eliminating blank samples, it still needs 709,000 vertices.
I'm wondering if a fragment program could eliminate all these quads and associated memory usage. What I'd like to do is have a 2x1024 texture, put the samples for one side of the triangle in row 0 and the samples for the other side in row 1. I draw a triangle with texCoords of 0,0 - 1,0 - 1,1 then have my fragment program dork with fragment texture coordinates (x,y are the incoming texCoords to the FP):
x' = x
y' = y / x
I use these new coordinates to look up my color in the 2x1024 texture. Essentially, I'm trying to pinch a quad into a triangle while maintaining the quad's interpolation.
Is this possible with a fragment program?
Thanks