   OpenGL Game Programming -book. A question.
  Ok, I recently bought this book and I'm quite satisfied with it.I've read about 1/4 of the book, but one thing keeps bugging me.On page 82 there's a matrix multiply calculation, but I can't realize why it's done like it is.Here's the calculation:The definition about matrix multiplying was explained like:"Well, given two matrices A and B, the idea is to take a row from A and multiply it by the corresponding column of B. Each element that is multiplied fom the A row and B row are then added together to give the new element of the resulting matrix."If this followed this definition, the result would be whole different:First you would multiply the row| 1 0 0 0 |with the column| x || y || z || 1 |Which would give:1*x + 0*y + 0*z + 0*1 = xAnd the second row multiplied the second the column would be:0*x + 1*y + 0*z + 0*1 = yThird:0*x + 0*y + 0*z + 1/focus*1 = 1/focusFourth:0*x + 0*y + -1*z + 0*1 = -zSo the final matrix would be:| x || y || 1/focus || -z |Instead of what it is.I DO see that the result that is on the book is gotten by multiplying A's columns by B's columns. But I don't have slightest idea WHY. It said that the multiplying works by row*col, hence I am a bit confused.It's not like it matters that much, but I'd like to know what's going on or I seriously can't sleep. Thanks in advance to anyone who can clarify this. [edited by - ramirez on February 19, 2004 9:05:34 AM][edited by - ramirez on February 19, 2004 9:06:28 AM]
  I might be wrong, because I dont know a whole lot about 3d graphics theory, but Im pretty sure I DO know how to multiply matrices, and I agree with your answer, not theirs. My first thought would be that its a typo in the book. It sure as hell isnt the only one, either, that book is packed full of them.On a side note, Id like to say that I also have that book, and although it was a good read an I learned a lot, i think it would be more aptly titled "Introduction to Opengl" rather than "Opengl Game Programming". Because about 98% of the material is just generic Opengl stuff that could be applied to ANY project - game or not. I think the authors made quite a bit more money by calling it "Game programming" than they would have if they simply called it "Opengl programming", even though the latter is what it really should be called. Cant blame them though, I probably would have done the same. ;  It''s an error in the book. As mentioned, the book has its share of them.I can''t agree with the 98% being generic OpenGL assessment. Only a little over half the book is OpenGL-specific.  Anyway, it''s the publisher who titles the book - not the authors.;  Hehe, yeah, I thought that it was a mistake too. But I just had to make sure.Thanks for clarifying, now I can sleep in peace.  