Hello,
If what you are trying to make is a 2D map, then you are only one glRotatef away from creating your vectors!
First you should glTranslatef(long.,lat.,0.0);
your rotation angle is theta=atan2(v,u) (atan2 found in most math libraries)
Then glRotatef(theta180/pi,0.0,0.0,1.0);
(atan2 gives you the angle in radians, theta180/pi changes to degrees, which opengl uses for rotations.)
Now your new x axis is aligned with your vector direction.
A GL_QUAD and a GL_TRIANGLE should be sufficient for a decent arrow.
So your code would be something like…
for (length of column of info) {
glLoadIdentity(); // always start at origin with no rotation
gltranslatef(long.,lat.,0.0); //current lat and long
theta=atan2(v,u);
glRotatef(theta180/pi,0.0,0.0,1.0); // rotate about z
mag=pow(vv+u*u,0.5); //magnitude of velocity vector
draw_arrow(mag) // function you make to draw arrow
};
glLoadIdentity(); // reset view
remember that your draw_arrow function is very simple since it will always draw an arrow pointing in the (local) x direction with magnitude mag.
Line contours are easy to do with GL_LINES
You can make some simple function to change line color as a function of depth like:
glColor3f(f1(depth),f2(depth),f3(depth)) // r,g,b, values
There are probably other (better) ways to do this but this is simple enough.
Of course, you need some logic checking routine to make the contours:
if (2 points have approximately the same depth) {
if(their is no point ‘between’ them with a different depth) {
draw a line between them with the appropriate color
};
};
If you are unfamiliar with any gl functions mentioned here, just google opengl tutorials and many will pop up (I recommend NeHe)
Hope this is helpful,
David