Hello,
I want to know if a matrix can be represented as a texture. I have a matrix which is 56x8 and I send it to my fragment shader as a sampler2D. To retrieve the contents of the matrix I use the function tex2D. Here is the code:
void main (uniform sampler2D texture,
in float4 color : COLOR0,
in float2 texcoord : TEXCOORD0,
out float4 point : COLOR0,
out float4 normal : COLOR1)
{
float4 point1, point2;
if (texcoord.x < 0.5) {
point1 = tex2D (texture, texcoord);
/* ------- calculations --------*/
point = result;
normal = result;
}
else {
point2 = tex2D (texture, texcoord);
/* ------- calculations --------*/
point = result;
normal = result;
}
}
So now I assume that the xyzw values of the point1 (that is, the RGBA values the tex2D has returned) represents the first 4 values of the matrix and point2 represents the next 4 values. Am I right? Can somebody please help?
Matrix as textures: Help Needed!
Started by mangal123, May 18 2007 06:45 PM
No replies to this topic
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











