read and write texture2D

Started by
13 comments, last by lomateron 12 years, 1 month ago
NOW I SEE. I remembered that the SDK tutorial 3 existed, a simple yellow triangle is drawn. I discovered that the pixel shader runs depending on the PrimitiveTopology and the vertex shader position. With only one point in the vertex buffer and the primitive tipology set to point list, the point position will be transformed into a pixel position of the back buffer texture, using the viewport, so normally without world, view, projection matrices and depth things, if the point position is D3DXVECTOR3( 1.0f, 1.0f, 0.0f ), the pixel in the upper right corner will be the one processed by the pixel shader method(the z value in the point never matters here). With 2 points in the vertex buffer one in the upper left corner D3DXVECTOR3( -1.0f, 1.0f, 0.0f ) and the other in the upper right corner D3DXVECTOR3( 1.0f, 1.0f, 0.0f ) and the PrimitiveTopology set to line strip, the pixel shader method will run across all the pixels between thos point(and logically in the point position too), yeahhhhh, now maybe you think that was simple, yesss it is, but if you understand it, that will take your knowledge of directx to a next LEVEL!! MOAHAHAHAHAHAHAHAHA
Now the problem is solved, bye.
Advertisement
I have succeed, very fast without any problem, but one last question, having this:

Texture2D Vectors;
[color=#000000]uint3 sampleCoord [color=#666600]=[color=#000000] uint3[color=#666600]([color=#000000]x[color=#666600],[color=#000000] y[color=#666600],[color=#000000] 1[color=#666600]);
[color=#000000]float3 sample [color=#666600]=[color=#000000] Vectors[color=#666600].[color=#660066]Load[color=#666600]([color=#000000]sampleCoord[color=#666600]);

then if (x,y)=(0,0), do I get the pixel that is in the upper left corner of the texture?
lest say the image is 50x50 pixels, then if (x,y)=(50,50), that will be the down right corner pixel of the texture?
That's right, except that the bottom right corner will be (49,49)
Damm i was wrong when i say, 3 posts back , if the point position is D3DXVECTOR3( 1.0f, 1.0f, 0.0f ), the pixel in the upper right corner will be the one processed by the pixel shader method, that pixel isn't in the upper right corner, that pixel is out of view, i mean it is just a little bit more up-right, north-east, that's really bad, why did the creators of directx did it like that.
hoo now i know how to fix that, just change the top left and right of the viewport.................. ohh no that dint fixed it, the pixel is never draw. what can i do :(

This topic is closed to new replies.

Advertisement