   the texture coordinate generate in eye linear mode
  Hi   Recently , I was confused about the texture coordinate generation in eye linear mode.   As you know , in eye linear mode , the generation function for the coordinate indicated by coord is g = p1' * Xe + p2' * Ye + p3' * Ze + p4' * WeAnd (Xe , Ye , Ze , We) = M * (x , y , z ,w) where M is the current model view matrixAnd ( p1' , p2', p3', p4') = (p1, p2 , p3 ,p4)*inverse(M);So the function is   g = (p1 , p2 , p3 , p4) * ( inverse(M) * M ) * (x , y , z , w)T;   g = (p1 , p2 , p3 , p4) * (x , y , z , w)T;It is the generation function in object linear mode, isn't is?So what's wrong with me?Thanks a lot!   
Quote:Original post by ruzhenchaoHi   Recently , I was confused about the texture coordinate generation in eye linear mode.   As you know , in eye linear mode , the generation function for the coordinate indicated by coord is g = p1' * Xe + p2' * Ye + p3' * Ze + p4' * WeAnd (Xe , Ye , Ze , We) = M * (x , y , z ,w) where M is the current model view matrixAnd ( p1' , p2', p3', p4') = (p1, p2 , p3 ,p4)*inverse(M);So the function is   g = (p1 , p2 , p3 , p4) * ( inverse(M) * M ) * (x , y , z , w)T;   g = (p1 , p2 , p3 , p4) * (x , y , z , w)T;It is the generation function in object linear mode, isn't is?So what's wrong with me?Thanks a lot!I think the problem is at the order of multiplication. Note that inverse(M) is applied to the plane so that both the plane and vertices reside in the same space, viewspace or camera space in our case. Now think about it, the plane equation is transformed to eye space like this:( p1', p2', p3', p4') = inverse(M) * (p1 , p2 , p3 , p4)T (premultiply with matrix)not like this:( p1' , p2', p3', p4') = (p1, p2 , p3 ,p4)T * inverse(M) (postmultiply)Having this said the equation now reads:g(x,y,z,w) = (inverse(M) * (p1 , p2 , p3 , p4)T) DOT M * (x , y , z , w)T;It seems you mixed column vectors and row vectors together, that isn't right :DWhen i saw the post i wanted to say: hey i have the same problem but after a little while of thinking i came up with this, if i did something wrong then please correct me.[Edited by - Deliverance on May 15, 2009 9:51:17 AM];  Thanks for you reply! And I have already know What's wrong with me!the equation is right ! the plane vector must be a row vector , so it can multiply by the position which is a column vector and generates the texture coordinate s,t,r or q!  The key points is the M!  I said that   if texture gen mode is EYE_LINEAR the gen function isg = p1' * Xe + p2' * Ye + p3' * Ze + p4' * We  And (Xe , Ye , Ze , We) = M * (x , y , z ,w) where M is the current model view matrixYes it is right!   ( p1' , p2', p3', p4') = (p1, p2 , p3 ,p4)*inverse(M)  this equation is wrong or not entirely correct! the M is not the current model  view , It is the model view Matrix when you call TexGen() function!so if you call the function like this:{  Transform(Matrix& M)  TexGen();  DrawSomething();}and the render result is just like OBJECT_LINEAR mode,because of the sameness of modelview Matrix.but if you call the functio like this:{   TexGen();   Transform(Matrix& M);   DrawSomething();}Yeah,this render result is what we want! And the model view Matrix when you callTexGen() function may be Identity Matrix and the model view Matrix when you call draw() function is M.So I made a mistake and Thanks all the same!   