Convert point sprites to a shape on a globe

Hi, OpenGL beginner here.

I am working on updating a project that plots moving aircraft on a globe. The application already uses point sprites for the planes. I need to replace these square sprites with some kind of shape (ie a triangle) where you can determine what direction the airplane is facing.

What is the best way to do this? Is this a trivial or difficult conversion? Can I still use glVertex3f for the positioning of my planes now that they are not sprites? Please help!

Here’s my suggestion. Make a subroutine called Display_Plane inside of which you have a simple, 2D, airplane model lying in the YZ plane with its nose pointed +Z. Translate this down the X axis to slightly more than your earth’s radius. Put PushMatrix and PopMatrix at the beginning and end of this subroutine. This should give you a plane flying due north at 0 deg lat and 0 deg lon (assuming +Z goes though the north pole and +X goes though 0 degs lat-lon). If your earth isn’t in this orientation, rotate it so it is. It will make things much easier. Let’s assume you have the lat, lon, and heading for each plane. ‘Heading’ is the direction of flight relative to due north with +90 being due East (i.e. a -X rotation). The pseudo-code below outlines a way to move each plane to the correct spot on the earth AND point it in the right direction.

If you don’t already have lat, lon, and heading, you’ll have to calculate it for each plane at each moment in time from the position data given to you. You will not be able to use glVertex anymore, but the alternative is almost as simple. Good luck.


void Fly_Planes (void)
{
    int i, t;
 
    for (t = 0; t < endtime ; t++)  {
       for (i = 0; i < numplanes; i++)  {
          Compute_LatLonHed (i);
          glPushMatrix ();
             glRotatef (lon[i],  0, 0, 1);
             glRotatef (lat[i],  0,-1, 0);
             glRotatef (hed[i], -1, 0, 0);
             Display_Plane ();
          glPopMatrix ();
       }
    }
}

void Draw_Scene (void)
{
    Draw_Globe();
    Fly_Planes();
}

MaxH, thank you so much for the helpful reply!

Can you direct me to resources on how to compose the Display_Plane() routine? Can a simple rendering of a triangle work?

Apologies for the newb questions, I am quite inexperienced with OpenGL. Thanks!

Yes. A triangle will work. The 2nd NeHe Tutorial shows you how to make a simple triangle.
You’ll need to scale it, translate, rotate it, etc., to orient it correctly on the earth’s surface (outlined in my first post).