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?