PDA

View Full Version : opengl graphs to be drawn



risha
11-04-2008, 05:05 AM
hi everybody,
I am working on borland builder C++ version 5.0. I am trying to use Opengl to draw graphs. The problem is " x axis on the graph represents time in secs and y represents data which is is pumped in by an external device. i need to have a continous scrolling data of secs written as text near the x axis and the graph is plotted in the middle of the opengl window(gltranslate( width/2,height/2,0) of the window).After 100 secs it should delete the index value data of 0 and the graph and text should draw from o to 101 and so on ..."

i am not sure as to post it in open gl forum or c++ forum.

Any help would be great. got stuck with this problem for long time.

Regards,
Risha

_NK47
11-04-2008, 06:30 AM
i dont really understand your problem. clarify in more detail.
i have similar graph thingy where i draw the memory usage and cpu workload as two graphs into the backbuffer with GL_LINES, line by line. it comes out to have sharp edges because lines just connect to other lines. is that what you want?

risha
12-13-2008, 10:54 PM
Thanks for response.I have tried everything but not working at all.
Quoted "i have similar graph thingy where i draw the memory usage and cpu workload as two graphs into the backbuffer with GL_LINES, line by line. it comes out to have sharp edges because lines just connect to other lines. "

nope not exactly but its is graph based application. I will clarify.

In elementary math we know x and y axis. We can plot points and draw lines connecting to it.

Similarily in my case x axis represents from 0 to 90 secs.(always). Y axis represents data which comes to by application as input based on a timer. I am using GL_LINE_STRIP when I finish till 90 secs the graphs draws great. When 90 secs finishes my xaxis becomes 0 again( which i want that way). so according to GL_LINE_STRIP it will connect the 90 value of x axis back to x zero value forming a loop. which i want to break.

I am <u>using vectors </u>for y axis values when y value reaches 90 elements I will delete the first element and append to the last of the vector array. this way my vector size remains at 90 elements always.

glVertex(x array,yarray);using GL_LINE_STRIP

can u Help?

thetinkerer
12-14-2008, 01:50 PM
What is unclear is how your x-axis becomes 0 again. That doesn't make any sense to me. Are you plotting data on a circle, or what?\

Update: I think I understand what you mean. You want your x-axis label to return to 0, but you really want to plot the next 0-90 range in what would logically be the 90-180 range, yes?