#include <Draw_Appli.hxx>
#include <OSD.hxx>
+#include <OSD_Environment.hxx>
#include <OSD_Timer.hxx>
#ifdef HAVE_SYS_TIME_H
// *******************************************************************
// main
// *******************************************************************
-#ifdef WNT
+#ifdef _WIN32
//Standard_EXPORT void Draw_Appli(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lps
Standard_EXPORT void Draw_Appli(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpszLine, int nShow,const FDraw_InitAppli Draw_InitAppli)
#else
void Draw_Appli(Standard_Integer argc, char** argv,const FDraw_InitAppli Draw_InitAppli)
#endif
{
+
+// prepend extra DLL search path to override system libraries like opengl32.dll
+#ifdef _WIN32
+ OSD_Environment aUserDllEnv ("CSF_UserDllPath");
+ TCollection_AsciiString aUserDllPath = aUserDllEnv.Value();
+ if (!aUserDllPath.IsEmpty())
+ {
+ // This function available since Win XP SP1 #if (_WIN32_WINNT >= 0x0502).
+ // We retrieve dynamically here (kernel32 should be always preloaded).
+ typedef BOOL (WINAPI *SetDllDirectoryA_t)(const char* thePathName);
+ HMODULE aKern32Module = GetModuleHandleA ("kernel32");
+ SetDllDirectoryA_t aFunc = (aKern32Module != NULL)
+ ? (SetDllDirectoryA_t )GetProcAddress (aKern32Module, "SetDllDirectoryA") : NULL;
+ if (aFunc != NULL)
+ {
+ aFunc (aUserDllPath.ToCString());
+ }
+ else
+ {
+ //std::cerr << "SetDllDirectoryA() is not available on this system!\n";
+ }
+ if (aKern32Module != NULL)
+ {
+ FreeLibrary (aKern32Module);
+ }
+ }
+#endif
+
// *****************************************************************
// analyze arguments
// *****************************************************************
Standard_Integer i;
Standard_Boolean isInteractiveForced = Standard_False;
-#ifdef WNT
+#ifdef _WIN32
// On NT command line arguments are in the lpzline and not in argv
int argc = 0;
const int MAXARGS = 1024;
return 0;
}
+//==============================================================================
+//function : VGlInfo
+//purpose :
+//==============================================================================
+
+static int VGlInfo (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ // get the active view
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (aView.IsNull())
+ {
+ std::cerr << "No active view. Please call vinit.\n";
+ return 1;
+ }
+
+ if (theArgNb <= 1)
+ {
+ theDI << "OpenGL info:\n"
+ << " GLvendor = '" << (const char* )glGetString(GL_VENDOR) << "'\n"
+ << " GLdevice = '" << (const char* )glGetString(GL_RENDERER) << "'\n"
+ << " GLversion = '" << (const char* )glGetString(GL_VERSION) << "'\n"
+ << " GLSLversion = '" << (const char* )glGetString(GL_SHADING_LANGUAGE_VERSION) << "'\n";
+ return 0;
+ }
+
+ const Standard_Boolean isList = theArgNb >= 3;
+ for (Standard_Integer anIter = 1; anIter < theArgNb; ++anIter)
+ {
+ TCollection_AsciiString aName (theArgVec[anIter]);
+ aName.UpperCase();
+ const char* aValue = NULL;
+ if (aName.Search ("VENDOR") != -1)
+ {
+ aValue = (const char* )glGetString (GL_VENDOR);
+ }
+ else if (aName.Search ("RENDERER") != -1)
+ {
+ aValue = (const char* )glGetString (GL_RENDERER);
+ }
+ else if (aName.Search ("SHADING_LANGUAGE_VERSION") != -1
+ || aName.Search ("GLSL") != -1)
+ {
+ aValue = (const char* )glGetString (GL_SHADING_LANGUAGE_VERSION);
+ }
+ else if (aName.Search ("VERSION") != -1)
+ {
+ aValue = (const char* )glGetString (GL_VERSION);
+ }
+ else if (aName.Search ("EXTENSIONS") != -1)
+ {
+ aValue = (const char* )glGetString (GL_EXTENSIONS);
+ }
+ else
+ {
+ std::cerr << "Unknown key '" << aName.ToCString() << "'\n";
+ return 1;
+ }
+
+ if (isList)
+ {
+ theDI << "{" << aValue << "} ";
+ }
+ else
+ {
+ theDI << aValue;
+ }
+ }
+
+ return 0;
+}
+
//=======================================================================
//function : OpenGlCommands
//purpose :
"vimmediatefront : render immediate mode to front buffer or to back buffer",
__FILE__, VImmediateFront, aGroup);
+ theCommands.Add("vglinfo",
+ "vglinfo [GL_VENDOR] [GL_RENDERER] [GL_VERSION] [GL_SHADING_LANGUAGE_VERSION] [GL_EXTENSIONS]"
+ " : prints GL info",
+ __FILE__, VGlInfo, aGroup);
}