3

I use sprite to display an image texture but the sprite width and height are in 3D world units and I need to automatically display the loaded image texture without stretching.

I know how to load a texture I only need a way to resize the sprite automatically according to the loaded image.

tools used are Delphi / GLScene

Szabolcs
  • 24,728
  • 9
  • 85
  • 174
zac
  • 4,495
  • 15
  • 62
  • 127

1 Answers1

2

Use a TGLHUDSprite, it'll be directly displayed and positioned in 2D in screen units.

TGLSprite is for when you want a sprite in 3D, you can position it in screen units, but you'll have to do the math for that (look at TGLHUDSprite's and imposter's source code for hints on that math).

Eric Grange
  • 5,931
  • 1
  • 39
  • 61
  • Maybe you could clarify what you're looking for then? – Eric Grange Feb 03 '12 at 07:42
  • I just want the sprite width and height to best suit the current size of the image texture in other words based on what I should set the size of the sprite object ? – zac Feb 04 '12 at 01:17
  • You can just get the size from the Delphi object that holds the image, which is going to be a TGraphic (be it a TBitmap, a TPNGImage, a TJPegImage, etc.), and TGraphic has Width/Height properties. – Eric Grange Feb 06 '12 at 08:59