Compiled code automatically closes ROOT GL viewer

Hi all,
I’m attempting to use the GL viewer in compiled code, and I’m running into an issue where the window closes at the end of the execution.
The code compiles and executes with no errors. Is there an addition to my code that needs to be made in order to prevent the window from automatically closing?

File attached, compiled with:

clang++ -o test GLview_test.cxx `root-config --cflags --glibs` -lGeom -lRGL

GLview_test.cxx (2.51 KB)

Hi,

Just add: tapp->Run();to make your TApplication running…

[color=#00BF00]EDIT:[/color]
And BTW, I would simplify (and clarify) the code that way:[code]int main(int argc, char *argv[])
{
TApplication *tapp = new TApplication(“tapp”,&argc,argv);
DrawGL();
tapp->Run();
return 0;
}

void DrawGL()
{
…[/code]
Cheers, Bertrand.

Wow I can’t believe I missed TApplication::Run, I was looking for something much more complicated – Thanks for that and thanks for the tip as well!