GLBasic forum

Main forum => GLBasic - en => Topic started by: XaMMaX on 2010-Oct-09

Title: X_SPRITE not working on gp2x
Post by: XaMMaX on 2010-Oct-09
Is there a way get to work X_SPRITE on the gp2x? Models work fine, but X_SPRITE now drawing(
Title: Re: X_SPRITE not working on gp2x
Post by: Scott_AW on 2010-Oct-10
One alternative would be to create your own billboard, but you'd be create a model every loop.

Using the camera's vertical and horizontal angles with SIN and COS you can recreate a ortho sprite.

Not actually tested...
Code (glbasic) Select

  hang = //Camera horizontal angle
  vang = //Camera vertical angle
  width = 64
  height = 64
  hw = width/2
  hh = height/2
  x_s = COS(hang+90) * hw
  x_e = COS(hang+90) * -hw
  y_s = SIN(vang) * hh
  y_e = SIN(vang) * -hh
  z_s = COS(hang+180) * hw
  z_e = COS(hang+180) * -hw

  X_OBJSTART
    X_OBJADDVERTEX x_s, y_s, z_e, 0, 0, rgb(255,255,255)
    X_OBJADDVERTEX x_s, y_e, z_e, 0, 1, rgb(255,255,255)
    X_OBJADDVERTEX x_e, y_s, z_s, 1, 0, rgb(255,255,255)
    X_OBJADDVERTEX x_e, y_e, z_s, 1, 1, rgb(255,255,255)
  X_OBJEND


May need some tweaking, but that's the basic idea.  Although its unfortunate to hear the x_sprite doesn't work correctly, I've been using that in my recent project :(