PDA

View Full Version : showing step by step



*zor*
07-04-2008, 02:24 AM
there is a vehicle that is moving.how can i show its coordinates step by step in opengl? either old coordinates or new coordinate should be drawn.after every 1 second,another new coordinate should be drawn.

dletozeun
07-04-2008, 03:01 AM
If you want to display text in the opengl viewport, you can use glut. See here:

lighthouse3D glut tutorial (http://www.lighthouse3d.com/opengl/glut/)

Another lib for character rendering:
QuesoGLC (http://quesoglc.sourceforge.net/)

*zor*
07-04-2008, 03:12 AM
no no

i want to draw point to each coordinate:/

dletozeun
07-04-2008, 03:16 AM
hu? Can you develop a bit more, your problem?

*zor*
07-04-2008, 04:48 AM
i want to draw graphic of a vehicle's journey. i have to add new position of the vehicle step by step.i should't draw all the graph at a moment.

dletozeun
07-04-2008, 09:12 AM
Set 2D projection and draw line stripes with GL_LINE_STRIP.

Zengar
07-04-2008, 09:47 AM
Use a timer and redraw the graph adding new points.

fldz
07-04-2008, 10:19 AM
Turn off all buffer swaps so every car draw draws over the last?

Zengar
07-04-2008, 02:07 PM
Turn off all buffer swaps so every car draw draws over the last?



A very good example of a bad idea. First, if you don't swap on a double buffered window, you just won't see anything. Second, if you use single buffered window... well, don't ever use single buffered windows ;)

zed
07-04-2008, 03:48 PM
i wouldnt draw a new a new point for the line each 1 second or so

ild only add new points if the car has moved enuf distance, this way youre not adding extra points if the cars stationary + also it handles the path correctly if the cars going quick.

if ( LENGTHOFVECTOR( car_pos - prev_car_point_pos ) > 1.0 )
{
add_point( car_pos );
}

you can do that either in screen or world space

CatDog
07-04-2008, 03:56 PM
zed, but if the car goes very fast, you'll add many redundant points!

I would check the curvature of the trail and add points only, if the angle between the last two segments exceeds a limit.

Funny thread. :)

CatDog

fldz
07-05-2008, 12:34 PM
Turn off all buffer swaps so every car draw draws over the last?



A very good example of a bad idea. First, if you don't swap on a double buffered window, you just won't see anything. Second, if you use single buffered window... well, don't ever use single buffered windows ;)

Not a bad idea, just badly worded. :) Well ok maybe both. Youre right, it isn't the swap, it's the neglecting to glClear where you see a bunch of acid-trip tracers. A record of motion as requested.
And no, I've never used acid.

zed
07-05-2008, 04:30 PM
zed, but if the car goes very fast, you'll add many redundant points!

I would check the curvature of the trail and add points only, if the angle between the last two segments exceeds a limit.
yes youre rights thats even better