TGraph, TH1F and openGL

Hi rooters,
I would like to ask about displaying data on TGraph or TH1F. To be more clearly I have few digitizers which collect some data. I want to display them on line. I wonder what would be the most efficient and the fastest way. I tried to use TGraph and function SetPoint(). But instead of setting point by point would be possible to send to TGraph a pointer to memory where data are stored? What about using openGL? it is enough to set SetCanvasPreferGL(kTRUE)? and then TGraph->Draw(“L”)? If I compare a modern computer games and amount of data which they transfer from memory to the graphic card I have impression that using TGraph is slow. It is possible to have direct access to graphic card from root application? Is ROOT suitable for this kind of application?
I wrote a simple macro to clarify the problem. Can somebody look at it and tell me how to make it more efficient?

Regards
Tomek
gDisp.C (1.1 KB)

[quote]Hi rooters,
I would like to ask about displaying data on TGraph or TH1F. To be more clearly I have few digitizers which collect some data. I want to display them on line. I wonder what would be the most efficient and the fastest way. I tried to use TGraph and function SetPoint(). But instead of setting point by point would be possible to send to TGraph a pointer to memory where data are stored?
[/quote]

TGraph has a constructor, which acepts a number of points, and xarray/yarray.

Well, yes and no. If you call SetCanvasPreferGL(kTRUE), OpenGL is used for painting the whole pad contents, but this does not mean, it must be faster (still, a lot of calculations is done by software, only X11-graphics part is replaced by OpenGL). But it can be faster. If you try $ROOTSYS/tutorials/graphs/seism.C in non-gl mode (default version of macro) and modify macro by adding gStyle->SetCanvasPreferGL(1) you’ll probably see difference. For example, on my laptop gl version of tutorial is two times faster.

I can have a look at your macro.

P.S.

Both gl and non-gl versions of you macro produce fast blinking pictures, both versions are fast. What’s wrong on your machine? I mean, is it slow or what?

P.P.S.

SetPoint is not terribly ineffective: if graph’s size is > your ‘i’, no memory allocation is done and only x and y values are set (so after the first call for SetNewValues, you already allocated all the memory required).
It calls gPad->Modified, which emits a signal, in fact I do not know, who’s connected (if anybody) and how expensive this emit.