Plotting points on Earth

Hi,
I’m new to OpenGL
I’m trying to plot points on earth and create a local XYZ coordinate system at those points. I’m not using glBegin/glEnd/glTranslate etc, but rather maintainig a 4x4 camera matrix myself and using PYGLET (OpenGL bindings for Python) to render the vertices.
My draw func looks like this

def on_draw():
“”“OpenGL drawing commands”""
“”“This function is called each frame”""

###############
## Render 3D ##
###############

# Clear buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

# Draw label each time to counter resizing window
label = pyglet.text.Label('Simulation',
                      font_name=Arial,
                      font_size=36,
                      x=-window.width//2, y=window.height//2,
                      anchor_x='left', anchor_y='top')
  
# Load camera view matrix
glLoadMatrixf(cam.viewMatrix)
glLineWidth(2)

# Draw lines
line_batch.draw()

In the below picture, I’m working in kilometres. I’ve created the X (red) Y (green) Z axes (blue) ([3000, 0, 0] … [0, 0, 3000]) My camera is looking at lines drawn from the origin to points on the earth (I’m in Australia) at Z = ~6371.8.

Basically, I want to create a mini X Y Z axes at these points so I can plot points relative to them. e.g. The Y axis would be 90deg perpendicular (straight up), forming the “NORTH” vector to the white lines as shown, and the x perpendicular to that etc. But I’m unsure of how to proceed. I could calculate the cross product, but what other vector do I calculate it with?

bump

Two separate issues here: 1) displaying East-North-Up (ENU) triads at different points on the earth’s surface, and 2) plotting things in those ENU coordinate systems. You don’t have to do any cross-products. Write a subroutine that plots an xyz triad at 0,0,0 and translates it to (1,0,0). By ‘1’, I mean 1.0 earth radii in whatever units you are using. Since there’s a glTranslate in this routine, it should start with glPushMatrix and end with glPopMatrix. This gives you a routine that renders an ENU system at 0.0 degs lat, 0.0 degs lon. Say you want to show an ENU triad at Sydney (-34 lat, +151 lon). Call your ENU routine with two glRotates before it. Would look something like:



 glPushMatrix ();
    glRotate (151, 0,0,1);   // longitude rotation (+Z)
    glRotate ( 34, 0,1,0);   // latitude  rotation (-Y)
    Draw_ENU_Triad ();
 glPopMatrix ();


That takes care of item #1.
For #2, any objects that are rendered inside the ENU routine will be translated and rotated to Sydney.