PDA

View Full Version : Drawing path using opengl



utkarsh07
03-04-2009, 09:22 AM
A aircraft is moving on a terrain by reading the x-y values from a file.
I wanted to trace the path of the aircraft by drawing the line.
But the problem is the file is very big and has lots of points so i cannot use glBegin(GL_LINE_STRIP) as it draws line starting form the initial point to the final but i cannot keep track of all the points as the coordinates from file are large in number.
I certainly has no idea how to proceed?????

Regards
Utkarsh

todayman
03-05-2009, 05:53 PM
How big is the file? I don't quite understand how that can be a problem...
I would use vertex arrays or vbo's/vao's ( I haven't started using OpenGL 3.0 yet )
Using those, I read the data into an array ( x,y,z,x,y,z,...), then say something like this:


glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(number of coordinates, type (GL_FLOAT), stride (0), data);
glDrawArrays(GL_LINE_STRIP, start (0), number of vertices);