Drawing arows in 3D

I am trying to draw arrows in 3 dimensional space. I looked into one of the examples
in $ROOTSYS/tutorials/eve/

root [0] .x arrow.C
Error in : BadRequest (invalid request code or no such operation) (XID: 62915322, XREQ: 154)

I see a window titled "Eve Main window " come up but the arrows are not drawn.
The problem seems to be associated with the call

gEve->FullRedraw3D(kTRUE);

since commenting out that line does not give any errors (of course the arrows are not drawn).

Thanks for any help.

Selemon

When I run this example I get the exact same picture shown here:
root.cern/doc/master/eve_2arrow_8C.html
The error you get seems to be related to X11. On which machine are you running ?
Does normal ROOT 2D graphics work ?

Dear Oliver, please find below the answers to your questions

===============

  1. On which machine are you running ?

Remote machine running ROOT

CentOS release 5.6
x86_64 GNU/Linux

Local machine from which I log into the remote machine

openSUSE 12.3 
x86_64 GNU/Linux
  1. Does normal ROOT 2D graphics work ?

Root 1D and 2D graphics work fine.

I appreciate your help very much.

Selemon

Hi,

I’d first try setting export LIBGL_ALWAYS_INDIRECT=1 on the remote machine.

Are you building root yourself? Then, can you please try inserting: fDLCache = kFALSE; // Disable display list.
into constructor of TEveArrowGL, here:
github.com/root-mirror/root/blo … GL.cxx#L33

Can you try also on some more recent remote OS? There were a bunch of issues on rhel-5 with intel graphics cards and mesa.

Cheers,
Matevz

Hi Matevz,

thanks for the help. I installed root on my local machine (openSUSE 12.3 x86_64 GNU/Linux) and was able to draw 3d arrows. The problem I have with the remote machine could be due to CentOS being an older version which I am not going to pursue any further. However, I have some more questions:
  1. Once I draw the arrows, how do I save the images as a PNG or some other format?

  2. Is there a way to color the arrows based on their length (say I have hundreds of arrows representing vectors of varying magnitudes and I want a gradient of colors to depict each vector)?

Thanks again,

Selemon

To save pictures, use:

TEveManager* eM = ...;
eM->GetDefaultGLViewer()->SavePicture("/tmp/a.png");

And for colors you can use ROOT’s palette … you just need to provide mapping functions from arrow length to palette index. Look at TColor and TStyle documentation about choosing / defining a palette.

nc = TColor::GetNumberOfColors() – returns number of colors in current palette.

ci = TColor::GetColorPalette(int c) – returns color index for color c; 0 <= c < nc

then eve_arrow->SetMainColor(ci);

I think there is a palette gallery somewhere on ROOT web.

Matevz

Hi All, thanks for all the help. The problem I had with drawing arrows in 3d is solved.