On 12/22/11 9:02 AM, Stefan Eilemann wrote:
> I need to get this from within a C++ program, i.e.:
> 
>   if( getenv( "VGL_RUNNING" ) != 0 )
>       doVglSpecificStuff();
> 
> Unless I am missing something, having an overlay logo doesn't help me.

It's not documented, but you could leverage the autotest mechanism that
the faker unit test program (server/fakerut.cpp) uses.  You would
basically putenv("VGL_AUTOTEST=1") from your application, do something
that triggers a readback, then look for the existence of environment
variables __VGL_AUTOTESTCLR{x} and __VGL_AUTOTESTFRAME{x}, where {x} is
the X11 drawable/window ID, in hex.  You'd then want to
putenv("VGL_AUTOTEST=0"), to turn off the autotest mechanism.

If you need to know of VGL's existence prior to that, you'd have to look
at the value of the LD_PRELOAD environment variable and see if it
contains "librrfaker.so".  I don't consider that to be wholly reliable,
however, because if the dynamic loader failed to find librrfaker.so, or
it couldn't be preloaded because of security reasons (such as the app
being setuid root), then the app would continue to run, but VirtualGL
would not be present, even though LD_PRELOAD would indicate otherwise.

I'd be happy to add something else to the environment earlier on in
VirtualGL's execution that would indicate its presence.  It would mean
that your application would require VirtualGL 2.3.1 or later, however.
There is a global class in faker.cpp that gets instantiated whenever the
library is loaded, so I could set an environment variable in there.

Maybe if I understood what "doVglSpecificStuff()" is, I could give you a
more solid answer.  I'm not sure why an application would want to change
up the way it renders because VirtualGL is present.  That's kind of
defeating the purpose of VirtualGL, which is to make remote display of
3D applications transparent to the application.  I could see where an
application might want to control VirtualGL.  For instance, if an
application wanted to provide its own "VirtualGL JPEG quality" slider,
it could simply putenv("VGL_QUAL={whatever}") in response to the slider
value, and VirtualGL would pick up the new value the next time it
displayed a frame.  There is no reason to check for VirtualGL's
existence in that case, however, since if VirtualGL isn't present, the
VGL_QUAL environment variable would be ignored.

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
VirtualGL-Devel mailing list
VirtualGL-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-devel

Reply via email to