 |
When backward is really forward
Posted by kirillcool on March 19, 2007 at 06:17 PM | Comments (8)
So, i'm reading a book and in one of the first chapters the authors try to put some reasoning behind an awkward API:
This process means that the last transformation command called in your program is actually the first one applied [...]. Thus, one way of looking at it is to say that you have to specify the matrices in the reverse order. Like many other things, however, once you've gotten used to thinking about this correctly, backward will
seem like forward.
Here, instead of acknowledging that the API implementation actually dictates the API usage, the authors try to blame the API users for being too dumb to grasp its beauty. It's not API, stupid, it's you not thinking about this correctly :)
Bookmark blog post: del.icio.us Digg DZone Furl Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Let me guess: OpenGL Programming Guide? :-)
Posted by: diverson on March 19, 2007 at 07:09 PM
-
Unless of course the person writing the API is a reverse engineer in which case I would have to agree that backwards is the best strategy to explain something that you have no idea how it was created in the first place....
Posted by: agrodrig on March 19, 2007 at 08:35 PM
-
Dean - guilty as charged.
Posted by: kirillcool on March 19, 2007 at 10:20 PM
-
The old row-major vs column-major matrix issue, if I'm remembering correctly.
That's one way around the DPI issue, right? Just draw everything in 3D space! :-)
Posted by: diverson on March 20, 2007 at 09:43 AM
-
To be fair, that's more a case of a poor description of a clean API than a poor API. There is a simple, mathematical model of defining 3D scenes using nested coordinate spaces related by affine transformations. That model needs to be clearly described, not side-stepped with some fluffy, hand-waving non-explanation.
Posted by: npryce on March 20, 2007 at 11:08 AM
-
npryce - the API is indeed clean, but its implementation (multiplying the top matrix by the passed matrix) dictates the API usage. Of course, this is done to make the hardware implementation simpler (fixed small matrix stack, no need to remember previous matrix unless the user explicitly requested), but still... The implementation details spill into the app logic.
Posted by: kirillcool on March 20, 2007 at 11:18 AM
-
Doesn't every API dictate how it should be used? I would agree with you if the spec said one thing, but the implementation did something different, but for OpenGL that's not the case.
Posted by: pepijnve on March 21, 2007 at 08:24 AM
-
:) !! backwards was everything where , Forth in code to needed never you glad be Just
Posted by: javakiddy on March 21, 2007 at 09:56 AM
|