Hey there.
I wasn't sure how you were going to include it in your game so i have moved all the relevant code, placed it in its own unit and have made it a class. This way you have the option of adding it, or ripping the code out of it.

I also made a couple of mods to it:
  • Phaser can now have a parent object. if it's assigned, the origin becomes relative to parent, otherwise it's absolute. Eg:
    Start(NullVector, GLsphere1.AbsolutePosition) will set the origin to (0,0,0) if no parent is assigned and the object's center if it is. The target is always absolute
  • Texture can now face any direction(it still rotates around the phaser). Just supply the eye origin to the Update method


If you are going to use the class then just a couple of things to note:
  • You must have a TGLDirectOpenGL component in your GLscene and never move the position of it from (0,0,0) or this will offset the phaser
  • Only call the Update method from the TGLDirectOpenGL onRender event (all other methods can be called from anywhere)
  • Materials must have their Texture wrapping set to tmBoth or the effect won't work (the repeat and especially the facing)
  • For all methods that expect coordinates, it's best to use an absolute position (except in the case of Start method


All compiled with Delphi 2009 but hopefully it will work in other versions. Zip contains:
  • testbed app from previous post (src tidied up but not commented)
  • phaser unit (src commented + <unzipped folder>\help\index.html)


Let me know of any bugs i may have missed
Download Src