Command testgrid now includes vglinfo into summary.
Command vinit has been extended by -virtual option creating an offscreen window.
Command vglinfo now splits long values into multiple lines.
Added test case v3d/glsl/glinfo dumping OpenGL context creation info.
OpenGl_Window - fixed initialization of OpenGL 4.6 Core Profile (was limited to 4.5).
lappend log "Host: [info hostname]"
lappend log "Started on: [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}]"
catch {lappend log "DRAW build:\n[dversion]" }
+ catch { pload VISUALIZATION; vinit g/v/info -virtual -w 2 -h 2 }
+ catch { lappend log "[vglinfo -complete -lineWidth 80]" }
+ catch { vclose g/v/info 0 }
lappend log "Environment:"
foreach envar [lsort [array names env]] {
lappend log "$envar=\"$env($envar)\""
// Try to create the core profile of highest OpenGL version supported by OCCT
// (this will be done automatically by some drivers when requesting 3.2,
// but some will not (e.g. AMD Catalyst) since WGL_ARB_create_context_profile specification allows both implementations).
- for (int aLowVer4 = 5; aLowVer4 >= 0 && aGContext == NULL; --aLowVer4)
+ for (int aLowVer4 = 6; aLowVer4 >= 0 && aGContext == NULL; --aLowVer4)
{
aCoreCtxAttribs[1] = 4;
aCoreCtxAttribs[3] = aLowVer4;
};
// try to create the core profile of highest OpenGL version supported by OCCT
- for (int aLowVer4 = 5; aLowVer4 >= 0 && aGContext == NULL; --aLowVer4)
+ for (int aLowVer4 = 6; aLowVer4 >= 0 && aGContext == NULL; --aLowVer4)
{
aCoreCtxAttribs[1] = 4;
aCoreCtxAttribs[3] = aLowVer4;
//! @param theViewName name of newly created View
//! @oaram theDisplayName display name
//! @param theViewToClone when specified, the new View will copy properties of existing one
+ //! @param theIsVirtual force creation of virtual off-screen window within interactive session
Standard_EXPORT static TCollection_AsciiString ViewerInit (const Standard_Integer thePxLeft = 0,
const Standard_Integer thePxTop = 0,
const Standard_Integer thePxWidth = 0,
const Standard_Integer thePxHeight = 0,
const TCollection_AsciiString& theViewName = "",
const TCollection_AsciiString& theDisplayName = "",
- const Handle(V3d_View)& theViewToClone = Handle(V3d_View)());
+ const Handle(V3d_View)& theViewToClone = Handle(V3d_View)(),
+ const Standard_Boolean theIsVirtual = false);
Standard_EXPORT static void RemoveViewName (const TCollection_AsciiString& theName);
return 1;
}
- Standard_Integer anArgIter = 1;
Graphic3d_DiagnosticInfo anInfoLevel = Graphic3d_DiagnosticInfo_Basic;
- if (theArgNb == 2)
+ Standard_Integer aLineWidth = 80;
+ NCollection_Sequence<TCollection_AsciiString> aKeys;
+ TColStd_IndexedDataMapOfStringString aDict;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
- TCollection_AsciiString aName (theArgVec[1]);
+ TCollection_AsciiString aName (theArgVec[anArgIter]);
aName.LowerCase();
+ TCollection_AsciiString aValue;
if (aName == "-short")
{
- ++anArgIter;
anInfoLevel = Graphic3d_DiagnosticInfo_Short;
}
else if (aName == "-basic")
{
- ++anArgIter;
anInfoLevel = Graphic3d_DiagnosticInfo_Basic;
}
else if (aName == "-complete"
|| aName == "-full")
{
- ++anArgIter;
anInfoLevel = Graphic3d_DiagnosticInfo_Complete;
}
+ else if (anArgIter + 1 < theArgNb
+ && (aName == "-maxwidth"
+ || aName == "-maxlinewidth"
+ || aName == "-linewidth"))
+ {
+ aLineWidth = Draw::Atoi (theArgVec[++anArgIter]);
+ if (aLineWidth < 0)
+ {
+ aLineWidth = IntegerLast();
+ }
+ }
+ else if (aName.Search ("vendor") != -1)
+ {
+ aKeys.Append ("GLvendor");
+ }
+ else if (aName.Search ("renderer") != -1)
+ {
+ aKeys.Append ("GLdevice");
+ }
+ else if (aName.Search ("shading_language_version") != -1
+ || aName.Search ("glsl") != -1)
+ {
+ aKeys.Append ("GLSLversion");
+ }
+ else if (aName.Search ("version") != -1)
+ {
+ aKeys.Append ("GLversion");
+ }
+ else if (aName.Search ("extensions") != -1)
+ {
+ aKeys.Append ("GLextensions");
+ }
+ else if (aName.Search ("extensions") != -1)
+ {
+ aKeys.Append ("GLextensions");
+ }
+ else
+ {
+ Message::SendFail() << "Syntax error: unknown key '" << aName << "'";
+ return 1;
+ }
}
- TColStd_IndexedDataMapOfStringString aDict;
- if (anArgIter >= theArgNb)
+ if (aKeys.IsEmpty())
{
aView->DiagnosticInformation (aDict, anInfoLevel);
TCollection_AsciiString aText;
{
aText += "\n";
}
- aText += TCollection_AsciiString(" ") + aValueIter.Key() + ": " + aValueIter.Value();
+ if ((aValueIter.Key().Length() + aValueIter.Value().Length() + 4) <= aLineWidth)
+ {
+ aText += TCollection_AsciiString(" ") + aValueIter.Key() + ": " + aValueIter.Value();
+ continue;
+ }
+
+ // split into lines
+ aText += TCollection_AsciiString(" ") + aValueIter.Key() + ":";
+ TCollection_AsciiString aSubList;
+ for (Standard_Integer aTokenIter = 1;; ++aTokenIter)
+ {
+ TCollection_AsciiString aToken = aValueIter.Value().Token (" ", aTokenIter);
+ if (aToken.IsEmpty())
+ {
+ break;
+ }
+
+ if (!aSubList.IsEmpty()
+ && (aSubList.Length() + aToken.Length() + 5) > aLineWidth)
+ {
+ aText += TCollection_AsciiString("\n ") + aSubList;
+ aSubList = aToken;
+ }
+ else
+ {
+ if (!aSubList.IsEmpty())
+ {
+ aSubList += " ";
+ }
+ aSubList += aToken;
+ }
+ }
+ if (!aSubList.IsEmpty())
+ {
+ aText += TCollection_AsciiString("\n ") + aSubList;
+ }
}
theDI << "OpenGL info:\n"
return 0;
}
- const Standard_Boolean isList = theArgNb >= 3;
aView->DiagnosticInformation (aDict, Graphic3d_DiagnosticInfo_Complete);
- for (; anArgIter < theArgNb; ++anArgIter)
+ for (NCollection_Sequence<TCollection_AsciiString>::Iterator aKeyIter (aKeys); aKeyIter.More(); aKeyIter.Next())
{
- TCollection_AsciiString aName (theArgVec[anArgIter]);
- aName.UpperCase();
- TCollection_AsciiString aValue;
- if (aName.Search ("VENDOR") != -1)
- {
- aValue = searchInfo (aDict, "GLvendor");
- }
- else if (aName.Search ("RENDERER") != -1)
- {
- aValue = searchInfo (aDict, "GLdevice");
- }
- else if (aName.Search ("SHADING_LANGUAGE_VERSION") != -1
- || aName.Search ("GLSL") != -1)
- {
- aValue = searchInfo (aDict, "GLSLversion");
- }
- else if (aName.Search ("VERSION") != -1)
- {
- aValue = searchInfo (aDict, "GLversion");
- }
- else if (aName.Search ("EXTENSIONS") != -1)
- {
- aValue = searchInfo (aDict, "GLextensions");
- }
- else
- {
- Message::SendFail() << "Syntax error: unknown key '" << aName.ToCString() << "'";
- return 1;
- }
-
- if (isList)
+ TCollection_AsciiString aValue = searchInfo (aDict, aKeyIter.Value());
+ if (aKeys.Length() > 1)
{
theDI << "{" << aValue << "} ";
}
"vimmediatefront : render immediate mode to front buffer or to back buffer",
__FILE__, VImmediateFront, aGroup);
theCommands.Add("vglinfo",
- "vglinfo [-short|-basic|-complete]"
+ "vglinfo [-short|-basic|-complete] [-lineWidth Value=80]"
"\n\t\t: [GL_VENDOR] [GL_RENDERER] [GL_VERSION]"
"\n\t\t: [GL_SHADING_LANGUAGE_VERSION] [GL_EXTENSIONS]"
- "\n\t\t: print OpenGL info",
+ "\n\t\t: print OpenGL info."
+ "\n\t\t: -lineWidth split values longer than specified value into multiple lines;"
+ "\n\t\t: -1 disables splitting.",
__FILE__, VGlInfo, aGroup);
theCommands.Add("vshader",
"vshader name -vert VertexShader -frag FragmentShader [-geom GeometryShader]"
const Standard_Integer thePxHeight,
const TCollection_AsciiString& theViewName,
const TCollection_AsciiString& theDisplayName,
- const Handle(V3d_View)& theViewToClone)
+ const Handle(V3d_View)& theViewToClone,
+ const Standard_Boolean theIsVirtual)
{
// Default position and dimension of the viewer window.
// Note that left top corner is set to be sufficiently small to have
Standard_Integer aPxWidth = 409;
Standard_Integer aPxHeight = 409;
Standard_Boolean toCreateViewer = Standard_False;
+ const Standard_Boolean isVirtual = Draw_VirtualWindows || theIsVirtual;
if (!theViewToClone.IsNull())
{
theViewToClone->Window()->Size (aPxWidth, aPxHeight);
SetDisplayConnection (new Aspect_DisplayConnection ());
#endif
- if (Draw_VirtualWindows)
+ if (isVirtual)
{
// don't waste the time waiting for VSync when window is not displayed on the screen
ViewerTest_myDefaultCaps.swapInterval = 0;
// Create window
#if defined(_WIN32)
VT_GetWindow() = new WNT_Window (aTitle.ToCString(), WClass(),
- Draw_VirtualWindows ? WS_POPUP : WS_OVERLAPPEDWINDOW,
+ isVirtual ? WS_POPUP : WS_OVERLAPPEDWINDOW,
aPxLeft, aPxTop,
aPxWidth, aPxHeight,
Quantity_NOC_BLACK);
aPxLeft, aPxTop,
aPxWidth, aPxHeight);
#endif
- VT_GetWindow()->SetVirtual (Draw_VirtualWindows);
+ VT_GetWindow()->SetVirtual (isVirtual);
// View setup
Handle(V3d_View) aView;
{
TCollection_AsciiString aViewName, aDisplayName;
Standard_Integer aPxLeft = 0, aPxTop = 0, aPxWidth = 0, aPxHeight = 0;
+ Standard_Boolean isVirtual = false;
Handle(V3d_View) aCopyFrom;
TCollection_AsciiString aName, aValue;
int is2dMode = -1;
{
aPxHeight = Draw::Atoi (theArgVec[++anArgIt]);
}
+ else if (anArgCase == "-virtual"
+ || anArgCase == "-offscreen")
+ {
+ isVirtual = true;
+ if (anArgIt + 1 < theArgsNb
+ && Draw::ParseOnOff (theArgVec[anArgIt + 1], isVirtual))
+ {
+ ++anArgIt;
+ }
+ }
else if (anArgCase == "-exitonclose")
{
ViewerTest_EventManager::ToExitOnCloseView() = true;
}
TCollection_AsciiString aViewId = ViewerTest::ViewerInit (aPxLeft, aPxTop, aPxWidth, aPxHeight,
- aViewName, aDisplayName, aCopyFrom);
+ aViewName, aDisplayName, aCopyFrom, isVirtual);
if (is2dMode != -1)
{
ViewerTest_V3dView::SetCurrentView2DMode (is2dMode == 1);
const char *group = "ZeViewer";
theCommands.Add("vinit",
"vinit [-name viewName] [-left leftPx] [-top topPx] [-width widthPx] [-height heightPx]"
- "\n\t\t: [-exitOnClose] [-closeOnEscape] [-cloneActive] [-2d_mode {on|off}=off]"
+ "\n\t\t: [-exitOnClose] [-closeOnEscape] [-cloneActive] [-virtual {on|off}=off] [-2d_mode {on|off}=off]"
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX))
"\n\t\t: [-display displayName]"
#endif
#endif
"\n\t\t: -left, -top pixel position of left top corner of the window."
"\n\t\t: -width, -height width and height of window respectively."
- "\n\t\t: -cloneActive floag to copy camera and dimensions of active view."
+ "\n\t\t: -cloneActive flag to copy camera and dimensions of active view."
"\n\t\t: -exitOnClose when specified, closing the view will exit application."
"\n\t\t: -closeOnEscape when specified, view will be closed on pressing Escape."
+ "\n\t\t: -virtual create an offscreen window within interactive session"
"\n\t\t: -2d_mode when on, view will not react on rotate scene events"
"\n\t\t: Additional commands for operations with views: vclose, vactivate, vviewlist.",
__FILE__,VInit,group);
--- /dev/null
+puts "============"
+puts "Print OpenGL info"
+puts "============"
+puts ""
+
+set to_dump_screen 0
+pload VISUALIZATION
+vclose ALL 0
+
+puts "=== Create compatible profile ==="
+vgldebug 0
+vcaps -core 0 -maxVersion -1 -1 -softMode 0
+vinit g1/v/info
+vglinfo -complete -lineWidth 80
+vclose ALL 0
+
+puts "=== Create core profile ==="
+vgldebug 0
+vcaps -core 1 -maxVersion -1 -1 -softMode 0
+vinit g1/v/info
+vglinfo -complete -lineWidth 80
+vclose ALL 0
+
+puts "=== Create version-restricted profile ==="
+vgldebug 0
+vcaps -core 0 -maxVersion 2 1 -softMode 0
+vinit g1/v/info
+vglinfo -complete -lineWidth 80
+vclose ALL 0
+
+puts "=== Create software emulated profile ==="
+vgldebug 0
+vcaps -core 0 -maxVersion -1 -1 -softMode 1
+vinit g1/v/info
+vglinfo -complete -lineWidth 80
+vclose ALL 0
+
+puts "=== Create debug profile ==="
+vgldebug 1
+vcaps -core 0 -maxVersion -1 -1 -softMode 0
+vinit g1/v/info
+vglinfo -complete -lineWidth 80
+vclose ALL 0
+
+vgldebug 0
+vcaps -core 0 -maxVersion -1 -1 -softMode 0