Added TKOpenGlTest and TKD3DHostTest Draw Harness plugins.
TKOpenGlTest is automatically loaded by ViewerTest::ViewerInit().
Commands vgldebug, vvbo, vcaps and vuserdraw have been moved to TKOpenGlTest.
New command vglshaders lists GLSL programs defined by OpenGl_GraphicDriver,
previously implemented by "vshaderprog -list".
Added new command vdriver for graphic driver selection.
Removed erroneous code from command vstereo.
if (NOT USE_D3D)
list (REMOVE_ITEM Visualization_TOOLKITS TKD3DHost)
+ list (REMOVE_ITEM Draw_TOOLKITS TKD3DHostTest)
endif()
# accumulate used toolkits (first level) in BUILD_TOOLKITS variable
Visualization TKService TKV3d TKOpenGl TKMeshVS TKIVtk TKD3DHost
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
DataExchange TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh
-Draw TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
+Draw TKDraw TKTopTest TKOpenGlTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE
n MeshTest
n SWDRAW
n TObjDRAW
+n OpenGlTest
+n D3DHostTest
n ViewerTest
n XDEDRAW
n XSDRAW
t TKDraw
t TKTObjDRAW
t TKTopTest
+t TKOpenGlTest
+t TKD3DHostTest
t TKViewerTest
t TKXDEDRAW
t TKXSDRAW
!HAVE_VTK:equals (aToolKit, "TKIVtk") { toSkipToolkit = 1 }
!HAVE_VTK:equals (aToolKit, "TKIVtkDraw") { toSkipToolkit = 1 }
!win32: equals (aToolKit, "TKD3DHost") { toSkipToolkit = 1 }
+ !win32: equals (aToolKit, "TKD3DHostTest") { toSkipToolkit = 1 }
equals (toSkipToolkit, 0) {
#warning(aToolKit($$OCC_MODULE_NAME)=$$aToolKit)
eval(occtkgen_$${aToolKit}.input = $$_PRO_FILE_PWD_/../OccToolkit.pro.in)
#Category: Modeling
#Title: Snowflake - creation of 2d drawing
-pload MODELING AISV
+pload MODELING VISUALIZATION
puts "Generating sample drawing of snowflake..."
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <D3DHost_GraphicDriverFactory.hxx>
+
+#include <D3DHost_GraphicDriver.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(D3DHost_GraphicDriverFactory, OpenGl_GraphicDriverFactory)
+
+// =======================================================================
+// function : D3DHost_GraphicDriverFactory
+// purpose :
+// =======================================================================
+D3DHost_GraphicDriverFactory::D3DHost_GraphicDriverFactory()
+{
+ myName = "TKD3DHost";
+}
+
+// =======================================================================
+// function : CreateDriver
+// purpose :
+// =======================================================================
+Handle(Graphic3d_GraphicDriver) D3DHost_GraphicDriverFactory::CreateDriver (const Handle(Aspect_DisplayConnection)& )
+{
+ Handle(D3DHost_GraphicDriver) aDriver = new D3DHost_GraphicDriver();
+ aDriver->ChangeOptions() = *myDefaultCaps;
+ aDriver->InitContext();
+ return aDriver;
+}
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _D3DHost_GraphicDriverFactory_Header
+#define _D3DHost_GraphicDriverFactory_Header
+
+#include <OpenGl_GraphicDriverFactory.hxx>
+
+//! This class for creation of D3DHost_GraphicDriver.
+class D3DHost_GraphicDriverFactory : public OpenGl_GraphicDriverFactory
+{
+ DEFINE_STANDARD_RTTIEXT(D3DHost_GraphicDriverFactory, OpenGl_GraphicDriverFactory)
+public:
+
+ //! Empty constructor.
+ Standard_EXPORT D3DHost_GraphicDriverFactory();
+
+ //! Creates new empty graphic driver.
+ Standard_EXPORT virtual Handle(Graphic3d_GraphicDriver) CreateDriver (const Handle(Aspect_DisplayConnection)& theDisp) Standard_OVERRIDE;
+
+};
+
+#endif //_D3DHost_GraphicDriverFactory_Header
D3DHost_GraphicDriver.hxx
D3DHost_GraphicDriver.cxx
+D3DHost_GraphicDriverFactory.hxx
+D3DHost_GraphicDriverFactory.cxx
D3DHost_FrameBuffer.hxx
D3DHost_FrameBuffer.cxx
D3DHost_View.hxx
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <D3DHostTest.hxx>
+
+#include <Draw_PluginMacro.hxx>
+#include <D3DHost_GraphicDriverFactory.hxx>
+
+// ======================================================================
+// function : Factory
+// purpose :
+// ======================================================================
+void D3DHostTest::Factory (Draw_Interpretor& )
+{
+ static const Handle(D3DHost_GraphicDriverFactory) aFactory = new D3DHost_GraphicDriverFactory();
+ Graphic3d_GraphicDriverFactory::RegisterFactory (aFactory);
+#ifdef DEB
+ theDI << "Draw Plugin : D3DHost commands are loaded.\n";
+#endif
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(D3DHostTest)
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _D3DHostTest_HeaderFile
+#define _D3DHostTest_HeaderFile
+
+#include <Draw_Interpretor.hxx>
+
+//! This package defines a set of Draw commands for testing of TKD3DHost library.
+class D3DHostTest
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+ //! Adds Draw commands to the draw interpretor.
+ Standard_EXPORT static void Commands (Draw_Interpretor& theDI);
+
+ //! Plugin entry point function.
+ Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
+};
+
+#endif // _D3DHostTest_HeaderFile
--- /dev/null
+D3DHostTest.cxx
+D3DHostTest.hxx
TOPTEST : TKTopTest
DCAF : TKDCAF
AISV : TKViewerTest
+OPENGL : TKOpenGlTest
+D3DHOST : TKD3DHostTest
XSDRAW : TKXSDRAW
XDEDRAW : TKXDEDRAW
TOBJ : TKTObjDRAW
file mkdir $tmpdir/$dir
# make snapshot
- pload AISV
+ pload VISUALIZATION
uplevel vdisplay a
uplevel vsetdispmode 1
uplevel vfit
Graphic3d_GraduatedTrihedron.hxx
Graphic3d_GraphicDriver.cxx
Graphic3d_GraphicDriver.hxx
+Graphic3d_GraphicDriverFactory.cxx
+Graphic3d_GraphicDriverFactory.hxx
Graphic3d_Group.cxx
Graphic3d_Group.hxx
Graphic3d_GroupAspect.hxx
//! Removes view from graphic driver and releases its resources.
virtual void RemoveView (const Handle(Graphic3d_CView)& theView) = 0;
- //! enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays
+ //! enables/disables usage of OpenGL vertex buffer arrays while drawing primitive arrays
virtual void EnableVBO (const Standard_Boolean status) = 0;
+
+ //! Returns TRUE if vertical synchronization with display refresh rate (VSync) should be used; TRUE by default.
+ virtual bool IsVerticalSync() const = 0;
+
+ //! Set if vertical synchronization with display refresh rate (VSync) should be used.
+ virtual void SetVerticalSync (bool theToEnable) = 0;
//! Returns information about GPU memory usage.
virtual Standard_Boolean MemoryInfo (Standard_Size& theFreeBytes, TCollection_AsciiString& theInfo) const = 0;
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <Graphic3d_GraphicDriverFactory.hxx>
+
+#include <Graphic3d_GraphicDriver.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_GraphicDriverFactory, Standard_Transient)
+
+namespace
+{
+ static Graphic3d_GraphicDriverFactoryList& getDriverFactories()
+ {
+ static Graphic3d_GraphicDriverFactoryList TheFactories;
+ return TheFactories;
+ }
+}
+
+// =======================================================================
+// function : DriverFactories
+// purpose :
+// =======================================================================
+const Graphic3d_GraphicDriverFactoryList& Graphic3d_GraphicDriverFactory::DriverFactories()
+{
+ return getDriverFactories();
+}
+
+// =======================================================================
+// function : RegisterFactory
+// purpose :
+// =======================================================================
+void Graphic3d_GraphicDriverFactory::RegisterFactory (const Handle(Graphic3d_GraphicDriverFactory)& theFactory,
+ bool theIsPreferred)
+{
+ const TCollection_AsciiString aName = theFactory->Name();
+ Graphic3d_GraphicDriverFactoryList& aFactories = getDriverFactories();
+ if (theIsPreferred)
+ {
+ UnregisterFactory (aName);
+ aFactories.Prepend (theFactory);
+ return;
+ }
+
+ for (Graphic3d_GraphicDriverFactoryList::Iterator anIter (aFactories); anIter.More(); anIter.Next())
+ {
+ if (TCollection_AsciiString::IsSameString (anIter.Value()->Name(), aName, false))
+ {
+ return;
+ }
+ }
+ aFactories.Append (theFactory);
+}
+
+// =======================================================================
+// function : UnregisterFactory
+// purpose :
+// =======================================================================
+void Graphic3d_GraphicDriverFactory::UnregisterFactory (const TCollection_AsciiString& theName)
+{
+ Graphic3d_GraphicDriverFactoryList& aFactories = getDriverFactories();
+ for (Graphic3d_GraphicDriverFactoryList::Iterator anIter (aFactories); anIter.More();)
+ {
+ if (TCollection_AsciiString::IsSameString (anIter.Value()->Name(), theName, false))
+ {
+ aFactories.Remove (anIter);
+ }
+ else
+ {
+ anIter.Next();
+ }
+ }
+}
+
+// =======================================================================
+// function : DefaultDriverFactory
+// purpose :
+// =======================================================================
+Handle(Graphic3d_GraphicDriverFactory) Graphic3d_GraphicDriverFactory::DefaultDriverFactory()
+{
+ const Graphic3d_GraphicDriverFactoryList& aMap = getDriverFactories();
+ return !aMap.IsEmpty()
+ ? aMap.First()
+ : Handle(Graphic3d_GraphicDriverFactory)();
+}
+
+// =======================================================================
+// function : Graphic3d_GraphicDriverFactory
+// purpose :
+// =======================================================================
+Graphic3d_GraphicDriverFactory::Graphic3d_GraphicDriverFactory (const TCollection_AsciiString& theName)
+: myName (theName)
+{
+ //
+}
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Graphic3d_GraphicDriverFactory_HeaderFile
+#define _Graphic3d_GraphicDriverFactory_HeaderFile
+
+#include <NCollection_List.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_AsciiString.hxx>
+
+class Aspect_DisplayConnection;
+class Graphic3d_GraphicDriver;
+class Graphic3d_GraphicDriverFactory;
+typedef NCollection_List<Handle(Graphic3d_GraphicDriverFactory)> Graphic3d_GraphicDriverFactoryList;
+
+//! This class for creation of Graphic3d_GraphicDriver.
+class Graphic3d_GraphicDriverFactory : public Standard_Transient
+{
+ DEFINE_STANDARD_RTTIEXT(Graphic3d_GraphicDriverFactory, Standard_Transient)
+public:
+
+ //! Registers factory.
+ //! @param theFactory [in] factory to register
+ //! @param theIsPreferred [in] add to the beginning of the list when TRUE, or add to the end otherwise
+ Standard_EXPORT static void RegisterFactory (const Handle(Graphic3d_GraphicDriverFactory)& theFactory,
+ bool theIsPreferred = false);
+
+ //! Unregisters factory.
+ Standard_EXPORT static void UnregisterFactory (const TCollection_AsciiString& theName);
+
+ //! Return default driver factory or NULL if no one was registered.
+ Standard_EXPORT static Handle(Graphic3d_GraphicDriverFactory) DefaultDriverFactory();
+
+ //! Return the global map of registered driver factories.
+ Standard_EXPORT static const Graphic3d_GraphicDriverFactoryList& DriverFactories();
+
+public:
+
+ //! Creates new empty graphic driver.
+ virtual Handle(Graphic3d_GraphicDriver) CreateDriver (const Handle(Aspect_DisplayConnection)& theDisp) = 0;
+
+ //! Return driver factory name.
+ const TCollection_AsciiString& Name() const { return myName; }
+
+protected:
+
+ //! Empty constructor.
+ Standard_EXPORT Graphic3d_GraphicDriverFactory (const TCollection_AsciiString& theName);
+
+protected:
+
+ TCollection_AsciiString myName;
+
+};
+
+#endif // _Graphic3d_GraphicDriverFactory_HeaderFile
;# Liste des toolkits WOK sous forme de full path
;#
proc Draw:toolkits { } {
- set aResult [list TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw]
+ set aResult [list TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw]
- if { [info exists ::env(HAVE_VTK)] && $::env(HAVE_VTK) == "true" } {
- lappend aResult "TKIVtkDraw"
+ lappend aResult "TKOpenGlTest"
+ if { "$::tcl_platform(platform)" == "windows" } {
+ if { [info exists ::env(HAVE_D3D)] } {
+ if { "$::env(HAVE_D3D)" == "true" } {
+ lappend aResult "TKD3DHostTest"
+ }
+ } elseif { [info exists ::env(VCVER)] && "$::env(VCVER)" != "vc8" && "$::env(VCVER)" != "vc9" && "$::env(VCVER)" != "vc10" } {
+ lappend aResult "TKD3DHostTest"
}
+ }
+ if { [info exists ::env(HAVE_VTK)] && "$::env(HAVE_VTK)" == "true" } {
+ lappend aResult "TKIVtkDraw"
+ }
- return $aResult
+ return $aResult
}
;#
;# Liste des toolkits WOK sous forme de full path
;#
proc Visualization:toolkits { } {
- set aResult [list TKService \
- TKV3d \
- TKOpenGl \
- TKMeshVS]
+ set aResult [list TKService TKV3d TKMeshVS]
- if { [info exists ::env(HAVE_VTK)] && "$::env(HAVE_VTK)" == "true" } {
- lappend aResult "TKIVtk"
- }
-
- if { "$::tcl_platform(platform)" == "windows" } {
- if { [info exists ::env(HAVE_D3D)] } {
- if { "$::env(HAVE_D3D)" == "true" } {
- lappend aResult "TKD3DHost"
- }
- } elseif { [info exists ::env(VCVER)] && "$::env(VCVER)" != "vc8" && "$::env(VCVER)" != "vc9" && "$::env(VCVER)" != "vc10" } {
+ lappend aResult "TKOpenGl"
+ if { "$::tcl_platform(platform)" == "windows" } {
+ if { [info exists ::env(HAVE_D3D)] } {
+ if { "$::env(HAVE_D3D)" == "true" } {
lappend aResult "TKD3DHost"
}
+ } elseif { [info exists ::env(VCVER)] && "$::env(VCVER)" != "vc8" && "$::env(VCVER)" != "vc9" && "$::env(VCVER)" != "vc10" } {
+ lappend aResult "TKD3DHost"
}
+ }
+ if { [info exists ::env(HAVE_VTK)] && "$::env(HAVE_VTK)" == "true" } {
+ lappend aResult "TKIVtk"
+ }
- return $aResult
+ return $aResult
}
+
;#
;# Autres UDs a prendre.
;#
OpenGl_LayerFilter.hxx
OpenGl_GraphicDriver.cxx
OpenGl_GraphicDriver.hxx
+OpenGl_GraphicDriverFactory.cxx
+OpenGl_GraphicDriverFactory.hxx
OpenGl_IndexBuffer.cxx
OpenGl_IndexBuffer.hxx
OpenGl_Layer.hxx
myCaps->vboDisable = !theToTurnOn;
}
+// =======================================================================
+// function : IsVerticalSync
+// purpose :
+// =======================================================================
+bool OpenGl_GraphicDriver::IsVerticalSync() const
+{
+ return myCaps->swapInterval == 1;
+}
+
+// =======================================================================
+// function : SetVerticalSync
+// purpose :
+// =======================================================================
+void OpenGl_GraphicDriver::SetVerticalSync (bool theToEnable)
+{
+ myCaps->swapInterval = theToEnable ? 1 : 0;
+}
+
// =======================================================================
// function : GetSharedContext
// purpose :
//! VBO usage can be forbidden by this method even if it is supported by GL driver.
//! Notice that disabling of VBO will cause rendering performance degradation.
//! Warning! This method should be called only before any primitives are displayed in GL scene!
- Standard_EXPORT void EnableVBO (const Standard_Boolean theToTurnOn) Standard_OVERRIDE;
+ Standard_EXPORT virtual void EnableVBO (const Standard_Boolean theToTurnOn) Standard_OVERRIDE;
+
+
+ //! Returns TRUE if vertical synchronization with display refresh rate (VSync) should be used; TRUE by default.
+ Standard_EXPORT virtual bool IsVerticalSync() const Standard_OVERRIDE;
+
+ //! Set if vertical synchronization with display refresh rate (VSync) should be used.
+ Standard_EXPORT virtual void SetVerticalSync (bool theToEnable) Standard_OVERRIDE;
//! Returns information about GPU memory usage.
//! Please read OpenGl_Context::MemoryInfo() for more description.
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <OpenGl_GraphicDriverFactory.hxx>
+
+#include <OpenGl_GraphicDriver.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(OpenGl_GraphicDriverFactory, Graphic3d_GraphicDriverFactory)
+
+// =======================================================================
+// function : OpenGl_GraphicDriverFactory
+// purpose :
+// =======================================================================
+OpenGl_GraphicDriverFactory::OpenGl_GraphicDriverFactory()
+: Graphic3d_GraphicDriverFactory ("TKOpenGl"),
+ myDefaultCaps (new OpenGl_Caps())
+{
+ //
+}
+
+// =======================================================================
+// function : CreateDriver
+// purpose :
+// =======================================================================
+Handle(Graphic3d_GraphicDriver) OpenGl_GraphicDriverFactory::CreateDriver (const Handle(Aspect_DisplayConnection)& theDisp)
+{
+ Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver (theDisp, false);
+ aDriver->ChangeOptions() = *myDefaultCaps;
+ aDriver->InitContext();
+ return aDriver;
+}
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _OpenGl_GraphicDriverFactory_Header
+#define _OpenGl_GraphicDriverFactory_Header
+
+#include <Graphic3d_GraphicDriverFactory.hxx>
+#include <OpenGl_Caps.hxx>
+
+//! This class for creation of OpenGl_GraphicDriver.
+class OpenGl_GraphicDriverFactory : public Graphic3d_GraphicDriverFactory
+{
+ DEFINE_STANDARD_RTTIEXT(OpenGl_GraphicDriverFactory, Graphic3d_GraphicDriverFactory)
+public:
+
+ //! Empty constructor.
+ Standard_EXPORT OpenGl_GraphicDriverFactory();
+
+ //! Creates new empty graphic driver.
+ Standard_EXPORT virtual Handle(Graphic3d_GraphicDriver) CreateDriver (const Handle(Aspect_DisplayConnection)& theDisp) Standard_OVERRIDE;
+
+ //! Return default driver options.
+ const Handle(OpenGl_Caps)& DefaultOptions() const { return myDefaultCaps; }
+
+ //! Set default driver options.
+ void SetDefaultOptions (const Handle(OpenGl_Caps)& theOptions) { myDefaultCaps = theOptions; }
+
+protected:
+
+ Handle(OpenGl_Caps) myDefaultCaps;
+
+};
+
+#endif //_OpenGl_GraphicDriverFactory_Header
--- /dev/null
+OpenGlTest.cxx
+OpenGlTest.hxx
+OpenGlTest_Commands.cxx
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <OpenGlTest.hxx>
+
+#include <Draw_PluginMacro.hxx>
+#include <OpenGl_GraphicDriverFactory.hxx>
+
+// ======================================================================
+// function : Factory
+// purpose :
+// ======================================================================
+void OpenGlTest::Factory (Draw_Interpretor& theDI)
+{
+ static const Handle(OpenGl_GraphicDriverFactory) aFactory = new OpenGl_GraphicDriverFactory();
+ Graphic3d_GraphicDriverFactory::RegisterFactory (aFactory);
+ OpenGlTest::Commands (theDI);
+#ifdef DEB
+ theDI << "Draw Plugin : OpenGL commands are loaded.\n";
+#endif
+}
+
+// Declare entry point PLUGINFACTORY
+DPLUGIN(OpenGlTest)
--- /dev/null
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _OpenGlTest_HeaderFile
+#define _OpenGlTest_HeaderFile
+
+#include <Draw_Interpretor.hxx>
+
+//! This package defines a set of Draw commands for testing of TKOpenGl library.
+class OpenGlTest
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+ //! Adds Draw commands to the draw interpretor.
+ Standard_EXPORT static void Commands (Draw_Interpretor& theDI);
+
+ //! Plugin entry point function.
+ Standard_EXPORT static void Factory (Draw_Interpretor& theDI);
+};
+
+#endif // _OpenGlTest_HeaderFile
--- /dev/null
+// Created on: 2012-04-09
+// Created by: Sergey ANIKIN
+// Copyright (c) 2012-2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <OpenGlTest.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx>
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_ShaderObject.hxx>
+#include <Graphic3d_ShaderProgram.hxx>
+#include <Message.hxx>
+
+#include <OpenGl_Aspects.hxx>
+#include <OpenGl_Context.hxx>
+#include <OpenGl_Element.hxx>
+#include <OpenGl_GlCore20.hxx>
+#include <OpenGl_GraphicDriver.hxx>
+#include <OpenGl_GraphicDriverFactory.hxx>
+#include <OpenGl_Group.hxx>
+#include <OpenGl_ShaderManager.hxx>
+#include <OpenGl_Workspace.hxx>
+
+#include <OSD_File.hxx>
+#include <OSD_OpenFile.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Select3D_SensitiveCurve.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <V3d_View.hxx>
+#include <V3d_Viewer.hxx>
+
+#include <ViewerTest.hxx>
+#include <ViewerTest_AutoUpdater.hxx>
+
+static Handle(OpenGl_Caps) getDefaultCaps()
+{
+ Handle(OpenGl_GraphicDriverFactory) aFactory = Handle(OpenGl_GraphicDriverFactory)::DownCast (Graphic3d_GraphicDriverFactory::DefaultDriverFactory());
+ if (aFactory.IsNull())
+ {
+ for (Graphic3d_GraphicDriverFactoryList::Iterator aFactoryIter (Graphic3d_GraphicDriverFactory::DriverFactories());
+ aFactoryIter.More(); aFactoryIter.Next())
+ {
+ aFactory = Handle(OpenGl_GraphicDriverFactory)::DownCast (aFactoryIter.Value());
+ if (!aFactory.IsNull())
+ {
+ break;
+ }
+ }
+ }
+ if (aFactory.IsNull())
+ {
+ throw Standard_ProgramError ("Error: no OpenGl_GraphicDriverFactory registered");
+ }
+ return aFactory->DefaultOptions();
+}
+
+namespace
+{
+
+//=======================================================================
+//function : VUserDraw
+//purpose : Checks availability and operation of UserDraw feature
+//=======================================================================
+class VUserDrawObj : public AIS_InteractiveObject
+{
+public:
+ // CASCADE RTTI
+ DEFINE_STANDARD_RTTI_INLINE(VUserDrawObj, AIS_InteractiveObject);
+
+ VUserDrawObj()
+ {
+ myCoords[0] = -10.;
+ myCoords[1] = -20.;
+ myCoords[2] = -30.;
+ myCoords[3] = 10.;
+ myCoords[4] = 20.;
+ myCoords[5] = 30.;
+ }
+
+public:
+ class Element : public OpenGl_Element
+ {
+ private:
+ Handle(VUserDrawObj) myIObj;
+
+ public:
+ Element (const Handle(VUserDrawObj)& theIObj) : myIObj (theIObj) {}
+
+ virtual ~Element() {}
+
+ virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
+ {
+ if (!myIObj.IsNull())
+ myIObj->Render(theWorkspace);
+ }
+
+ virtual void Release (OpenGl_Context*)
+ {
+ //
+ }
+
+ public:
+ DEFINE_STANDARD_ALLOC
+ };
+
+private:
+ // Virtual methods implementation
+ virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
+ const Handle(Prs3d_Presentation)& thePrs,
+ const Standard_Integer theMode) Standard_OVERRIDE;
+
+ virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Integer theMode) Standard_OVERRIDE;
+
+ // Called by VUserDrawElement
+ void Render(const Handle(OpenGl_Workspace)& theWorkspace) const;
+
+private:
+ GLfloat myCoords[6];
+ friend class Element;
+};
+
+void VUserDrawObj::Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
+ const Handle(Prs3d_Presentation)& thePrs,
+ const Standard_Integer theMode)
+{
+ if (theMode != 0) { return; }
+ thePrs->Clear();
+
+ Graphic3d_Vec4 aBndMin (myCoords[0], myCoords[1], myCoords[2], 1.0f);
+ Graphic3d_Vec4 aBndMax (myCoords[3], myCoords[4], myCoords[5], 1.0f);
+ Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast (thePrs->NewGroup());
+ aGroup->SetMinMaxValues (aBndMin.x(), aBndMin.y(), aBndMin.z(),
+ aBndMax.x(), aBndMax.y(), aBndMax.z());
+ aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
+ VUserDrawObj::Element* anElem = new VUserDrawObj::Element (this);
+ aGroup->AddElement(anElem);
+
+ // invalidate bounding box of the scene
+ thePrsMgr->StructureManager()->Update();
+}
+
+void VUserDrawObj::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Integer theMode)
+{
+ if (theMode != 0) { return; }
+ Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner(this);
+ Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 5);
+ aPnts->SetValue(1, gp_Pnt(myCoords[0], myCoords[1], myCoords[2]));
+ aPnts->SetValue(2, gp_Pnt(myCoords[3], myCoords[4], myCoords[2]));
+ aPnts->SetValue(3, gp_Pnt(myCoords[3], myCoords[4], myCoords[5]));
+ aPnts->SetValue(4, gp_Pnt(myCoords[0], myCoords[1], myCoords[5]));
+ aPnts->SetValue(5, gp_Pnt(myCoords[0], myCoords[1], myCoords[2]));
+ Handle(Select3D_SensitiveCurve) aSensitive = new Select3D_SensitiveCurve(anEntityOwner, aPnts);
+ theSelection->Add(aSensitive);
+}
+
+void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
+{
+ const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
+
+ // To test linking against OpenGl_Workspace and all aspect classes
+ const OpenGl_Aspects* aMA = theWorkspace->Aspects();
+ aMA->Aspect()->MarkerType();
+ OpenGl_Vec4 aColor = theWorkspace->InteriorColor();
+
+ aCtx->ShaderManager()->BindLineProgram (Handle(OpenGl_TextureSet)(), Aspect_TOL_SOLID,
+ Graphic3d_TOSM_UNLIT, Graphic3d_AlphaMode_Opaque, false,
+ Handle(OpenGl_ShaderProgram)());
+ aCtx->SetColor4fv (aColor);
+
+ const OpenGl_Vec3 aVertArray[4] =
+ {
+ OpenGl_Vec3(myCoords[0], myCoords[1], myCoords[2]),
+ OpenGl_Vec3(myCoords[3], myCoords[4], myCoords[2]),
+ OpenGl_Vec3(myCoords[3], myCoords[4], myCoords[5]),
+ OpenGl_Vec3(myCoords[0], myCoords[1], myCoords[5]),
+ };
+ Handle(OpenGl_VertexBuffer) aVertBuffer = new OpenGl_VertexBuffer();
+ aVertBuffer->Init (aCtx, 3, 4, aVertArray[0].GetData());
+
+ // Finally draw something to make sure UserDraw really works
+ aVertBuffer->BindAttribute (aCtx, Graphic3d_TOA_POS);
+ glDrawArrays(GL_LINE_LOOP, 0, aVertBuffer->GetElemsNb());
+ aVertBuffer->UnbindAttribute(aCtx, Graphic3d_TOA_POS);
+ aVertBuffer->Release (aCtx.get());
+}
+
+} // end of anonymous namespace
+
+static Standard_Integer VUserDraw (Draw_Interpretor& ,
+ Standard_Integer argc,
+ const char ** argv)
+{
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ if (aContext.IsNull())
+ {
+ Message::SendFail ("Error: no active viewer");
+ return 1;
+ }
+
+ Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContext->CurrentViewer()->Driver());
+ if (aDriver.IsNull())
+ {
+ Message::SendFail ("Error: Graphic driver not available.");
+ return 1;
+ }
+
+ if (argc > 2)
+ {
+ Message::SendFail ("Syntax error: wrong number of arguments");
+ return 1;
+ }
+
+ TCollection_AsciiString aName (argv[1]);
+ ViewerTest::Display (aName, Handle(AIS_InteractiveObject)());
+
+ Handle(VUserDrawObj) anIObj = new VUserDrawObj();
+ ViewerTest::Display (aName, anIObj);
+
+ return 0;
+}
+
+//==============================================================================
+//function : VGlShaders
+//purpose :
+//==============================================================================
+static Standard_Integer VGlShaders (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
+ if (aCtx.IsNull())
+ {
+ Message::SendFail ("Error: no active viewer");
+ return 1;
+ }
+
+ Handle(OpenGl_Context) aGlCtx;
+ if (Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aCtx->CurrentViewer()->Driver()))
+ {
+ aGlCtx = aDriver->GetSharedContext();
+ }
+ if (aGlCtx.IsNull())
+ {
+ Message::SendFail ("Error: no OpenGl_Context");
+ return 1;
+ }
+
+ bool toList = theArgNb < 2;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+ {
+ TCollection_AsciiString anArg (theArgVec[anArgIter]);
+ anArg.LowerCase();
+ if (anArg == "-list")
+ {
+ toList = true;
+ }
+ else if ((anArg == "-update"
+ || anArg == "-dump"
+ || anArg == "-debug"
+ || anArg == "-reload"
+ || anArg == "-load")
+ && anArgIter + 1 < theArgNb)
+ {
+ TCollection_AsciiString aShaderName = theArgVec[++anArgIter];
+ Handle(OpenGl_ShaderProgram) aResProg;
+ if (!aGlCtx->GetResource (aShaderName, aResProg))
+ {
+ Message::SendFail() << "Syntax error: shader resource '" << aShaderName << "' is not found";
+ return 1;
+ }
+ if (aResProg->UpdateDebugDump (aGlCtx, "", false, anArg == "-dump"))
+ {
+ aCtx->UpdateCurrentViewer();
+ }
+ return 0;
+ }
+ else
+ {
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
+ return 1;
+ }
+ }
+ if (toList)
+ {
+ for (OpenGl_Context::OpenGl_ResourcesMap::Iterator aResIter (aGlCtx->SharedResources()); aResIter.More(); aResIter.Next())
+ {
+ if (Handle(OpenGl_ShaderProgram) aResProg = Handle(OpenGl_ShaderProgram)::DownCast (aResIter.Value()))
+ {
+ theDI << aResProg->ResourceId() << " ";
+ }
+ }
+ }
+
+ return 0;
+}
+
+//! Auxiliary function for parsing glsl dump level argument.
+static Standard_Boolean parseGlslSourceFlag (Standard_CString theArg,
+ OpenGl_ShaderProgramDumpLevel& theGlslDumpLevel)
+{
+ TCollection_AsciiString aTypeStr (theArg);
+ aTypeStr.LowerCase();
+ if (aTypeStr == "off"
+ || aTypeStr == "0")
+ {
+ theGlslDumpLevel = OpenGl_ShaderProgramDumpLevel_Off;
+ }
+ else if (aTypeStr == "short")
+ {
+ theGlslDumpLevel = OpenGl_ShaderProgramDumpLevel_Short;
+ }
+ else if (aTypeStr == "full"
+ || aTypeStr == "1")
+ {
+ theGlslDumpLevel = OpenGl_ShaderProgramDumpLevel_Full;
+ }
+ else
+ {
+ return Standard_False;
+ }
+ return Standard_True;
+}
+
+//==============================================================================
+//function : VGlDebug
+//purpose :
+//==============================================================================
+static int VGlDebug (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ Handle(OpenGl_GraphicDriver) aDriver;
+ Handle(V3d_View) aView = ViewerTest::CurrentView();
+ if (!aView.IsNull())
+ {
+ aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aView->Viewer()->Driver());
+ }
+ OpenGl_Caps* aDefCaps = getDefaultCaps().get();
+ OpenGl_Caps* aCaps = !aDriver.IsNull() ? &aDriver->ChangeOptions() : NULL;
+
+ if (theArgNb < 2)
+ {
+ TCollection_AsciiString aDebActive, aSyncActive;
+ if (aCaps == NULL)
+ {
+ aCaps = aDefCaps;
+ }
+ else
+ {
+ Standard_Boolean isActive = OpenGl_Context::CheckExtension ((const char* )::glGetString (GL_EXTENSIONS),
+ "GL_ARB_debug_output");
+ aDebActive = isActive ? " (active)" : " (inactive)";
+ if (isActive)
+ {
+ // GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
+ aSyncActive = ::glIsEnabled (0x8242) == GL_TRUE ? " (active)" : " (inactive)";
+ }
+ }
+
+ TCollection_AsciiString aGlslCodeDebugStatus = TCollection_AsciiString()
+ + "glslSourceCode: "
+ + (aCaps->glslDumpLevel == OpenGl_ShaderProgramDumpLevel_Off
+ ? "Off"
+ : aCaps->glslDumpLevel == OpenGl_ShaderProgramDumpLevel_Short
+ ? "Short"
+ : "Full")
+ + "\n";
+ theDI << "debug: " << (aCaps->contextDebug ? "1" : "0") << aDebActive << "\n"
+ << "sync: " << (aCaps->contextSyncDebug ? "1" : "0") << aSyncActive << "\n"
+ << "glslWarn: " << (aCaps->glslWarnings ? "1" : "0") << "\n"
+ << aGlslCodeDebugStatus
+ << "extraMsg: " << (aCaps->suppressExtraMsg ? "0" : "1") << "\n";
+ return 0;
+ }
+
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+ {
+ Standard_CString anArg = theArgVec[anArgIter];
+ TCollection_AsciiString anArgCase (anArg);
+ anArgCase.LowerCase();
+ Standard_Boolean toEnableDebug = Standard_True;
+ if (anArgCase == "-glsl"
+ || anArgCase == "-glslwarn"
+ || anArgCase == "-glslwarns"
+ || anArgCase == "-glslwarnings")
+ {
+ Standard_Boolean toShowWarns = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toShowWarns))
+ {
+ --anArgIter;
+ }
+ aDefCaps->glslWarnings = toShowWarns;
+ if (aCaps != NULL)
+ {
+ aCaps->glslWarnings = toShowWarns;
+ }
+ }
+ else if (anArgCase == "-extra"
+ || anArgCase == "-extramsg"
+ || anArgCase == "-extramessages")
+ {
+ Standard_Boolean toShow = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toShow))
+ {
+ --anArgIter;
+ }
+ aDefCaps->suppressExtraMsg = !toShow;
+ if (aCaps != NULL)
+ {
+ aCaps->suppressExtraMsg = !toShow;
+ }
+ }
+ else if (anArgCase == "-noextra"
+ || anArgCase == "-noextramsg"
+ || anArgCase == "-noextramessages")
+ {
+ Standard_Boolean toSuppress = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toSuppress))
+ {
+ --anArgIter;
+ }
+ aDefCaps->suppressExtraMsg = toSuppress;
+ if (aCaps != NULL)
+ {
+ aCaps->suppressExtraMsg = toSuppress;
+ }
+ }
+ else if (anArgCase == "-sync")
+ {
+ Standard_Boolean toSync = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toSync))
+ {
+ --anArgIter;
+ }
+ aDefCaps->contextSyncDebug = toSync;
+ if (toSync)
+ {
+ aDefCaps->contextDebug = Standard_True;
+ }
+ }
+ else if (anArgCase == "-glslsourcecode"
+ || anArgCase == "-glslcode")
+ {
+ OpenGl_ShaderProgramDumpLevel aGslsDumpLevel = OpenGl_ShaderProgramDumpLevel_Full;
+ if (++anArgIter < theArgNb
+ && !parseGlslSourceFlag (theArgVec[anArgIter], aGslsDumpLevel))
+ {
+ --anArgIter;
+ }
+ aDefCaps->glslDumpLevel = aGslsDumpLevel;
+ if (aCaps != NULL)
+ {
+ aCaps->glslDumpLevel = aGslsDumpLevel;
+ }
+ }
+ else if (anArgCase == "-debug")
+ {
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnableDebug))
+ {
+ --anArgIter;
+ }
+ aDefCaps->contextDebug = toEnableDebug;
+ }
+ else if (Draw::ParseOnOff (anArg, toEnableDebug)
+ && (anArgIter + 1 == theArgNb))
+ {
+ // simple alias to turn on almost everything
+ aDefCaps->contextDebug = toEnableDebug;
+ aDefCaps->contextSyncDebug = toEnableDebug;
+ aDefCaps->glslWarnings = toEnableDebug;
+ if (!toEnableDebug)
+ {
+ aDefCaps->glslDumpLevel = OpenGl_ShaderProgramDumpLevel_Off;
+ }
+ aDefCaps->suppressExtraMsg = !toEnableDebug;
+ if (aCaps != NULL)
+ {
+ aCaps->contextDebug = toEnableDebug;
+ aCaps->contextSyncDebug = toEnableDebug;
+ aCaps->glslWarnings = toEnableDebug;
+ if (!toEnableDebug)
+ {
+ aCaps->glslDumpLevel = OpenGl_ShaderProgramDumpLevel_Off;
+ }
+ aCaps->suppressExtraMsg = !toEnableDebug;
+ }
+ }
+ else
+ {
+ Message::SendFail() << "Syntax error at '" << anArg << "'";
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+//==============================================================================
+//function : VVbo
+//purpose :
+//==============================================================================
+static int VVbo (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ const Standard_Boolean toSet = (theArgNb > 1);
+ const Standard_Boolean toUseVbo = toSet ? (Draw::Atoi (theArgVec[1]) == 0) : 1;
+ if (toSet)
+ {
+ getDefaultCaps()->vboDisable = toUseVbo;
+ }
+
+ // get the context
+ Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
+ if (aContextAIS.IsNull())
+ {
+ if (!toSet)
+ {
+ Message::SendFail ("Error: no active viewer");
+ }
+ return 1;
+ }
+ Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
+ if (!aDriver.IsNull())
+ {
+ if (!toSet)
+ {
+ theDI << (aDriver->Options().vboDisable ? "0" : "1") << "\n";
+ }
+ else
+ {
+ aDriver->ChangeOptions().vboDisable = toUseVbo;
+ }
+ }
+
+ return 0;
+}
+
+//==============================================================================
+//function : VCaps
+//purpose :
+//==============================================================================
+static int VCaps (Draw_Interpretor& theDI,
+ Standard_Integer theArgNb,
+ const char** theArgVec)
+{
+ OpenGl_Caps* aCaps = getDefaultCaps().get();
+ Handle(OpenGl_GraphicDriver) aDriver;
+ Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+ if (!aContext.IsNull())
+ {
+ aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContext->CurrentViewer()->Driver());
+ aCaps = &aDriver->ChangeOptions();
+ }
+
+ if (theArgNb < 2)
+ {
+ theDI << "sRGB: " << (aCaps->sRGBDisable ? "0" : "1") << "\n";
+ theDI << "VBO: " << (aCaps->vboDisable ? "0" : "1") << "\n";
+ theDI << "Sprites: " << (aCaps->pntSpritesDisable ? "0" : "1") << "\n";
+ theDI << "SoftMode:" << (aCaps->contextNoAccel ? "1" : "0") << "\n";
+ theDI << "FFP: " << (aCaps->ffpEnable ? "1" : "0") << "\n";
+ theDI << "PolygonMode: " << (aCaps->usePolygonMode ? "1" : "0") << "\n";
+ theDI << "DepthZeroToOne: " << (aCaps->useZeroToOneDepth ? "1" : "0") << "\n";
+ theDI << "VSync: " << aCaps->swapInterval << "\n";
+ theDI << "Compatible:" << (aCaps->contextCompatible ? "1" : "0") << "\n";
+ theDI << "Stereo: " << (aCaps->contextStereo ? "1" : "0") << "\n";
+ theDI << "WinBuffer: " << (aCaps->useSystemBuffer ? "1" : "0") << "\n";
+ theDI << "OpaqueAlpha: " << (aCaps->buffersOpaqueAlpha ? "1" : "0") << "\n";
+ theDI << "NoExt:" << (aCaps->contextNoExtensions ? "1" : "0") << "\n";
+ theDI << "MaxVersion:" << aCaps->contextMajorVersionUpper << "." << aCaps->contextMinorVersionUpper << "\n";
+ theDI << "CompressTextures: " << (aCaps->compressedTexturesDisable ? "0" : "1") << "\n";
+ return 0;
+ }
+
+ ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+ {
+ Standard_CString anArg = theArgVec[anArgIter];
+ TCollection_AsciiString anArgCase (anArg);
+ anArgCase.LowerCase();
+ if (anUpdateTool.parseRedrawMode (anArg))
+ {
+ continue;
+ }
+ else if (anArgCase == "-vsync"
+ || anArgCase == "-swapinterval")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->swapInterval = toEnable;
+ }
+ else if (anArgCase == "-ffp")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->ffpEnable = toEnable;
+ }
+ else if (anArgCase == "-polygonmode")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->usePolygonMode = toEnable;
+ }
+ else if (anArgCase == "-srgb")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->sRGBDisable = !toEnable;
+ }
+ else if (anArgCase == "-compressedtextures")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->compressedTexturesDisable = !toEnable;
+ }
+ else if (anArgCase == "-vbo")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->vboDisable = !toEnable;
+ }
+ else if (anArgCase == "-sprite"
+ || anArgCase == "-sprites")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->pntSpritesDisable = !toEnable;
+ }
+ else if (anArgCase == "-depthzerotoone"
+ || anArgCase == "-zerotoonedepth"
+ || anArgCase == "-usezerotoonedepth"
+ || anArgCase == "-iszerotoonedepth")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->useZeroToOneDepth = toEnable;
+ }
+ else if (anArgCase == "-softmode")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->contextNoAccel = toEnable;
+ }
+ else if (anArgCase == "-opaquealpha"
+ || anArgCase == "-buffersOpaqueAlpha")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->buffersOpaqueAlpha = toEnable;
+ }
+ else if (anArgCase == "-winbuffer"
+ || anArgCase == "-windowbuffer"
+ || anArgCase == "-usewinbuffer"
+ || anArgCase == "-usewindowbuffer"
+ || anArgCase == "-usesystembuffer")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->useSystemBuffer = toEnable;
+ }
+ else if (anArgCase == "-accel"
+ || anArgCase == "-acceleration")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->contextNoAccel = !toEnable;
+ }
+ else if (anArgCase == "-compat"
+ || anArgCase == "-compatprofile"
+ || anArgCase == "-compatible"
+ || anArgCase == "-compatibleprofile")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->contextCompatible = toEnable;
+ if (!aCaps->contextCompatible)
+ {
+ aCaps->ffpEnable = Standard_False;
+ }
+ }
+ else if (anArgCase == "-core"
+ || anArgCase == "-coreprofile")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->contextCompatible = !toEnable;
+ if (!aCaps->contextCompatible)
+ {
+ aCaps->ffpEnable = Standard_False;
+ }
+ }
+ else if (anArgCase == "-stereo"
+ || anArgCase == "-quadbuffer")
+ {
+ Standard_Boolean toEnable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
+ {
+ --anArgIter;
+ }
+ aCaps->contextStereo = toEnable;
+ }
+ else if (anArgCase == "-noext"
+ || anArgCase == "-noextensions"
+ || anArgCase == "-noextension")
+ {
+ Standard_Boolean toDisable = Standard_True;
+ if (++anArgIter < theArgNb
+ && !Draw::ParseOnOff (theArgVec[anArgIter], toDisable))
+ {
+ --anArgIter;
+ }
+ aCaps->contextNoExtensions = toDisable;
+ }
+ else if (anArgCase == "-maxversion"
+ || anArgCase == "-upperversion"
+ || anArgCase == "-limitversion")
+ {
+ Standard_Integer aVer[2] = { -2, -1 };
+ for (Standard_Integer aValIter = 0; aValIter < 2; ++aValIter)
+ {
+ if (anArgIter + 1 < theArgNb)
+ {
+ const TCollection_AsciiString aStr (theArgVec[anArgIter + 1]);
+ if (aStr.IsIntegerValue())
+ {
+ aVer[aValIter] = aStr.IntegerValue();
+ ++anArgIter;
+ }
+ }
+ }
+ if (aVer[0] < -1
+ || aVer[1] < -1)
+ {
+ Message::SendFail() << "Syntax error at '" << anArgCase << "'";
+ return 1;
+ }
+ aCaps->contextMajorVersionUpper = aVer[0];
+ aCaps->contextMinorVersionUpper = aVer[1];
+ }
+ else
+ {
+ Message::SendFail() << "Error: unknown argument '" << anArg << "'";
+ return 1;
+ }
+ }
+ if (aCaps != getDefaultCaps().get())
+ {
+ *getDefaultCaps() = *aCaps;
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : Commands
+//purpose :
+//=======================================================================
+void OpenGlTest::Commands (Draw_Interpretor& theCommands)
+{
+ const char* aGroup ="Commands for low-level TKOpenGl features";
+
+ theCommands.Add("vuserdraw",
+ "vuserdraw : name - simulates drawing with help of UserDraw",
+ __FILE__, VUserDraw, aGroup);
+ theCommands.Add("vglshaders",
+ "vglshaders [-list] [-dump] [-reload] ShaderId"
+ "\n\t\t: -list prints the list of registered GLSL programs"
+ "\n\t\t: -dump dumps specified GLSL program (for debugging)"
+ "\n\t\t: -reload restores dump of specified GLSL program",
+ __FILE__, VGlShaders, aGroup);
+ theCommands.Add ("vcaps",
+ "vcaps [-sRGB {0|1}] [-vbo {0|1}] [-sprites {0|1}] [-ffp {0|1}] [-polygonMode {0|1}]"
+ "\n\t\t: [-compatibleProfile {0|1}] [-compressedTextures {0|1}]"
+ "\n\t\t: [-vsync {0|1}] [-useWinBuffer {0|1}] [-opaqueAlpha {0|1}]"
+ "\n\t\t: [-quadBuffer {0|1}] [-stereo {0|1}]"
+ "\n\t\t: [-softMode {0|1}] [-noupdate|-update]"
+ "\n\t\t: [-zeroToOneDepth {0|1}]"
+ "\n\t\t: [-noExtensions {0|1}] [-maxVersion Major Minor]"
+ "\n\t\t: Modify particular graphic driver options:"
+ "\n\t\t: sRGB - enable/disable sRGB rendering"
+ "\n\t\t: FFP - use fixed-function pipeline instead of"
+ "\n\t\t: built-in GLSL programs"
+ "\n\t\t: (requires compatible profile)"
+ "\n\t\t: polygonMode - use Polygon Mode instead of built-in GLSL programs"
+ "\n\t\t: compressedTexture - allow uploading of GPU-supported compressed texture formats"
+ "\n\t\t: VBO - use Vertex Buffer Object (copy vertex"
+ "\n\t\t: arrays to GPU memory)"
+ "\n\t\t: sprite - use textured sprites instead of bitmaps"
+ "\n\t\t: vsync - switch VSync on or off"
+ "\n\t\t: opaqueAlpha - disable writes in alpha component of color buffer"
+ "\n\t\t: winBuffer - allow using window buffer for rendering"
+ "\n\t\t: zeroToOneDepth - use [0,1] depth range instead of [-1,1] range"
+ "\n\t\t: Context creation options:"
+ "\n\t\t: softMode - software OpenGL implementation"
+ "\n\t\t: compatibleProfile - backward-compatible profile"
+ "\n\t\t: quadbuffer - QuadBuffer"
+ "\n\t\t: noExtensions - disallow usage of extensions"
+ "\n\t\t: maxVersion - force upper OpenGL version to be used"
+ "\n\t\t: These parameters control alternative"
+ "\n\t\t: rendering paths producing the same visual result when possible.",
+ __FILE__, VCaps, aGroup);
+ theCommands.Add ("vgldebug",
+ "vgldebug [-sync {0|1}] [-debug {0|1}] [-glslWarn {0|1}]"
+ "\n\t\t: [-glslCode {off|short|full}] [-extraMsg {0|1}] [{0|1}]"
+ "\n\t\t: Request debug GL context. Should be called BEFORE vinit."
+ "\n\t\t: Debug context can be requested only on Windows"
+ "\n\t\t: with GL_ARB_debug_output extension implemented by GL driver!"
+ "\n\t\t: -sync - request synchronized debug GL context"
+ "\n\t\t: -glslWarn - log GLSL compiler/linker warnings,"
+ "\n\t\t: which are suppressed by default,"
+ "\n\t\t: -glslCode - log GLSL program source code,"
+ "\n\t\t: which are suppressed by default,"
+ "\n\t\t: -extraMsg - log extra diagnostic messages from GL context,"
+ "\n\t\t: which are suppressed by default",
+ __FILE__, VGlDebug, aGroup);
+ theCommands.Add ("vvbo",
+ "vvbo [{0|1}] : turn VBO usage On/Off; affects only newly displayed objects",
+ __FILE__, VVbo, aGroup);
+}
--- /dev/null
+project(TKD3DHostTest)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
--- /dev/null
+TKernel
+TKMath
+TKDraw
+TKD3DHost
+TKService
--- /dev/null
+EXTERNLIB
+PACKAGES
--- /dev/null
+D3DHostTest
--- /dev/null
+project(TKOpenGlTest)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
--- /dev/null
+TKernel
+TKMath
+TKDraw
+TKOpenGl
+TKService
+TKV3d
+TKViewerTest
+CSF_OpenGlLibs
--- /dev/null
+EXTERNLIB
+PACKAGES
--- /dev/null
+OpenGlTest
TKMesh
TKV3d
TKDraw
-TKOpenGl
CSF_TclLibs
CSF_TclTkLibs
CSF_XwLibs
CSF_user32
CSF_gdi32
-CSF_OpenGlLibs
CSF_objc
CSF_Appkit
CSF_IOKit
#include <ViewerTest.hxx>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_InteractiveObject.hxx>
#include <Draw.hxx>
#include <Draw_Interpretor.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_ShaderObject.hxx>
-#include <Graphic3d_ShaderProgram.hxx>
#include <Image_AlienPixMap.hxx>
-#include <OpenGl_Aspects.hxx>
-#include <OpenGl_Context.hxx>
-#include <OpenGl_Element.hxx>
-#include <OpenGl_GlCore20.hxx>
-#include <OpenGl_GraphicDriver.hxx>
-#include <OpenGl_ShaderManager.hxx>
-#include <OpenGl_Workspace.hxx>
-#include <OSD_Environment.hxx>
+#include <Message.hxx>
#include <OSD_File.hxx>
#include <OSD_OpenFile.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_Presentation.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <Select3D_SensitiveCurve.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <TCollection_AsciiString.hxx>
#include <V3d_View.hxx>
#include <V3d_Viewer.hxx>
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
+
#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
-#include <OpenGl_Group.hxx>
-#include <OSD_OpenFile.hxx>
-extern Standard_Boolean VDisplayAISObject (const TCollection_AsciiString& theName,
- const Handle(AIS_InteractiveObject)& theAISObj,
- Standard_Boolean theReplaceIfExists = Standard_True);
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-namespace
-{
-
-//=======================================================================
-//function : VUserDraw
-//purpose : Checks availability and operation of UserDraw feature
-//=======================================================================
-class VUserDrawObj : public AIS_InteractiveObject
-{
-public:
- // CASCADE RTTI
- DEFINE_STANDARD_RTTI_INLINE(VUserDrawObj, AIS_InteractiveObject);
-
- VUserDrawObj()
- {
- myCoords[0] = -10.;
- myCoords[1] = -20.;
- myCoords[2] = -30.;
- myCoords[3] = 10.;
- myCoords[4] = 20.;
- myCoords[5] = 30.;
- }
-
-public:
- class Element : public OpenGl_Element
- {
- private:
- Handle(VUserDrawObj) myIObj;
-
- public:
- Element (const Handle(VUserDrawObj)& theIObj) : myIObj (theIObj) {}
-
- virtual ~Element() {}
-
- virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
- {
- if (!myIObj.IsNull())
- myIObj->Render(theWorkspace);
- }
-
- virtual void Release (OpenGl_Context*)
- {
- //
- }
-
- public:
- DEFINE_STANDARD_ALLOC
- };
-
-private:
- // Virtual methods implementation
- virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
- const Handle(Prs3d_Presentation)& thePrs,
- const Standard_Integer theMode) Standard_OVERRIDE;
-
- virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Integer theMode) Standard_OVERRIDE;
-
- // Called by VUserDrawElement
- void Render(const Handle(OpenGl_Workspace)& theWorkspace) const;
-
-private:
- GLfloat myCoords[6];
- friend class Element;
-};
-
-void VUserDrawObj::Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
- const Handle(Prs3d_Presentation)& thePrs,
- const Standard_Integer /*theMode*/)
-{
- thePrs->Clear();
-
- Graphic3d_Vec4 aBndMin (myCoords[0], myCoords[1], myCoords[2], 1.0f);
- Graphic3d_Vec4 aBndMax (myCoords[3], myCoords[4], myCoords[5], 1.0f);
- Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast (thePrs->NewGroup());
- aGroup->SetMinMaxValues (aBndMin.x(), aBndMin.y(), aBndMin.z(),
- aBndMax.x(), aBndMax.y(), aBndMax.z());
- aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
- VUserDrawObj::Element* anElem = new VUserDrawObj::Element (this);
- aGroup->AddElement(anElem);
-
- // invalidate bounding box of the scene
- thePrsMgr->StructureManager()->Update();
-}
-
-void VUserDrawObj::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
- const Standard_Integer /*theMode*/)
-{
- Handle(SelectMgr_EntityOwner) anEntityOwner = new SelectMgr_EntityOwner(this);
- Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 5);
- aPnts->SetValue(1, gp_Pnt(myCoords[0], myCoords[1], myCoords[2]));
- aPnts->SetValue(2, gp_Pnt(myCoords[3], myCoords[4], myCoords[2]));
- aPnts->SetValue(3, gp_Pnt(myCoords[3], myCoords[4], myCoords[5]));
- aPnts->SetValue(4, gp_Pnt(myCoords[0], myCoords[1], myCoords[5]));
- aPnts->SetValue(5, gp_Pnt(myCoords[0], myCoords[1], myCoords[2]));
- Handle(Select3D_SensitiveCurve) aSensitive = new Select3D_SensitiveCurve(anEntityOwner, aPnts);
- theSelection->Add(aSensitive);
-}
-
-void VUserDrawObj::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
-{
- const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
-
- // To test linking against OpenGl_Workspace and all aspect classes
- const OpenGl_Aspects* aMA = theWorkspace->Aspects();
- aMA->Aspect()->MarkerType();
- OpenGl_Vec4 aColor = theWorkspace->InteriorColor();
-
- aCtx->ShaderManager()->BindLineProgram (Handle(OpenGl_TextureSet)(), Aspect_TOL_SOLID,
- Graphic3d_TOSM_UNLIT, Graphic3d_AlphaMode_Opaque, false,
- Handle(OpenGl_ShaderProgram)());
- aCtx->SetColor4fv (aColor);
-
- const OpenGl_Vec3 aVertArray[4] =
- {
- OpenGl_Vec3(myCoords[0], myCoords[1], myCoords[2]),
- OpenGl_Vec3(myCoords[3], myCoords[4], myCoords[2]),
- OpenGl_Vec3(myCoords[3], myCoords[4], myCoords[5]),
- OpenGl_Vec3(myCoords[0], myCoords[1], myCoords[5]),
- };
- Handle(OpenGl_VertexBuffer) aVertBuffer = new OpenGl_VertexBuffer();
- aVertBuffer->Init (aCtx, 3, 4, aVertArray[0].GetData());
-
- // Finally draw something to make sure UserDraw really works
- aVertBuffer->BindAttribute (aCtx, Graphic3d_TOA_POS);
- glDrawArrays(GL_LINE_LOOP, 0, aVertBuffer->GetElemsNb());
- aVertBuffer->UnbindAttribute(aCtx, Graphic3d_TOA_POS);
- aVertBuffer->Release (aCtx.get());
-}
-
-} // end of anonymous namespace
-
-static Standard_Integer VUserDraw (Draw_Interpretor& ,
- Standard_Integer argc,
- const char ** argv)
-{
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
- if (aContext.IsNull())
- {
- Message::SendFail ("Error: no active viewer");
- return 1;
- }
-
- Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContext->CurrentViewer()->Driver());
- if (aDriver.IsNull())
- {
- Message::SendFail ("Error: Graphic driver not available.");
- return 1;
- }
-
- if (argc > 2)
- {
- Message::SendFail ("Syntax error: wrong number of arguments");
- return 1;
- }
-
- TCollection_AsciiString aName (argv[1]);
- VDisplayAISObject(aName, Handle(AIS_InteractiveObject)());
-
- Handle(VUserDrawObj) anIObj = new VUserDrawObj();
- VDisplayAISObject(aName, anIObj);
-
- return 0;
-}
-
//==============================================================================
//function : VImmediateFront
//purpose :
//==============================================================================
-static int VImmediateFront (Draw_Interpretor& /*theDI*/,
+static int VImmediateFront (Draw_Interpretor& ,
Standard_Integer theArgNb,
const char** theArgVec)
{
return 0;
}
+
//! Parse shader type argument.
static bool parseShaderTypeArg (Graphic3d_TypeOfShaderObject& theType,
const TCollection_AsciiString& theArg)
//function : VShaderProg
//purpose : Sets the pair of vertex and fragment shaders for the object
//==============================================================================
-static Standard_Integer VShaderProg (Draw_Interpretor& theDI,
+static Standard_Integer VShaderProg (Draw_Interpretor& ,
Standard_Integer theArgNb,
const char** theArgVec)
{
TCollection_AsciiString aName = theArgVec[++anArgIter];
aProgram->PushVariableFloat (aName, float (Draw::Atof (theArgVec[++anArgIter])));
}
- else if (anArg == "-list"
- || ((anArg == "-update"
- || anArg == "-dump"
- || anArg == "-debug"
- || anArg == "-reload"
- || anArg == "-load")
- && anArgIter + 1 < theArgNb))
- {
- Handle(OpenGl_Context) aGlCtx;
- if (Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aCtx->CurrentViewer()->Driver()))
- {
- aGlCtx = aDriver->GetSharedContext();
- }
- if (aGlCtx.IsNull())
- {
- Message::SendFail ("Error: no OpenGl_Context");
- return 1;
- }
-
- if (anArg == "-list")
- {
- for (OpenGl_Context::OpenGl_ResourcesMap::Iterator aResIter (aGlCtx->SharedResources()); aResIter.More(); aResIter.Next())
- {
- if (Handle(OpenGl_ShaderProgram) aResProg = Handle(OpenGl_ShaderProgram)::DownCast (aResIter.Value()))
- {
- theDI << aResProg->ResourceId() << " ";
- }
- }
- }
- else
- {
- TCollection_AsciiString aShaderName = theArgVec[++anArgIter];
- Handle(OpenGl_ShaderProgram) aResProg;
- if (!aGlCtx->GetResource (aShaderName, aResProg))
- {
- Message::SendFail() << "Syntax error: shader resource '" << aShaderName << "' is not found";
- return 1;
- }
- if (aResProg->UpdateDebugDump (aGlCtx, "", false, anArg == "-dump"))
- {
- aCtx->UpdateCurrentViewer();
- }
- }
- if (anArgIter + 1 < theArgNb)
- {
- Message::SendFail ("Syntax error: wrong number of arguments");
- return 1;
- }
- return 0;
- }
else if (!aProgram.IsNull()
&& aProgram->ShaderObjects().IsEmpty()
&& (anArg == "-off"
{
const char* aGroup ="Commands for low-level TKOpenGl features";
- theCommands.Add("vuserdraw",
- "vuserdraw : name - simulates drawing with help of UserDraw",
- __FILE__, VUserDraw, aGroup);
theCommands.Add("vimmediatefront",
"vimmediatefront : render immediate mode to front buffer or to back buffer",
__FILE__, VImmediateFront, aGroup);
"\n\t\t: [-header VersionHeader]"
"\n\t\t: [-tessControl TessControlShader -tesseval TessEvaluationShader]"
"\n\t\t: [-uniform Name FloatValue]"
- "\n\t\t: Assign custom GLSL program to presentation aspects."
- "\nvshader [-list] [-dump] [-reload] ShaderId"
- "\n\t\t: -list prints the list of registered GLSL programs"
- "\n\t\t: -dump dumps specified GLSL program (for debugging)"
- "\n\t\t: -reload restores dump of specified GLSL program",
+ "\n\t\t: Assign custom GLSL program to presentation aspects.",
__FILE__, VShaderProg, aGroup);
theCommands.Add("vshaderprog", "Alias for vshader", __FILE__, VShaderProg, aGroup);
theCommands.Add("vlistmaterials",
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <OpenGl_GlCore20.hxx>
+#if defined(_WIN32)
+ #include <windows.h>
+#endif
+
#include <ViewerTest.hxx>
#include <AIS_AnimationCamera.hxx>
#include <Graphic3d_CubeMapPacked.hxx>
#include <Graphic3d_CubeMapSeparate.hxx>
#include <Graphic3d_GraduatedTrihedron.hxx>
+#include <Graphic3d_GraphicDriver.hxx>
+#include <Graphic3d_GraphicDriverFactory.hxx>
#include <Graphic3d_NameOfTextureEnv.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Graphic3d_TextureEnv.hxx>
#include <Image_AlienPixMap.hxx>
#include <Image_Diff.hxx>
#include <Image_VideoRecorder.hxx>
+#include <Message.hxx>
#include <Message_ProgressScope.hxx>
#include <Message_ProgressRange.hxx>
#include <NCollection_DataMap.hxx>
#include <OSD.hxx>
#include <OSD_Parallel.hxx>
#include <OSD_Timer.hxx>
-#include <OpenGl_GraphicDriver.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d_Drawer.hxx>
NCollection_DoubleMap <TCollection_AsciiString, Handle(V3d_View)> ViewerTest_myViews;
static NCollection_DoubleMap <TCollection_AsciiString, Handle(AIS_InteractiveContext)> ViewerTest_myContexts;
static NCollection_DoubleMap <TCollection_AsciiString, Handle(Graphic3d_GraphicDriver)> ViewerTest_myDrivers;
-static OpenGl_Caps ViewerTest_myDefaultCaps;
static void OSWindowSetup();
theViewToClone->Window()->Size (aPxWidth, aPxHeight);
}
- Handle(OpenGl_GraphicDriver) aGraphicDriver;
+ Handle(Graphic3d_GraphicDriverFactory) aFactory = Graphic3d_GraphicDriverFactory::DefaultDriverFactory();
+ if (aFactory.IsNull())
+ {
+ Draw::GetInterpretor().Eval ("pload OPENGL");
+ aFactory = Graphic3d_GraphicDriverFactory::DefaultDriverFactory();
+ if (aFactory.IsNull())
+ {
+ throw Standard_ProgramError("Error: no graphic driver factory found");
+ }
+ }
+
+ Handle(Graphic3d_GraphicDriver) aGraphicDriver;
ViewerTest_Names aViewNames(theViewName);
if (ViewerTest_myViews.IsBound1 (aViewNames.GetViewName ()))
aViewNames.SetViewName (aViewNames.GetViewerName() + "/" + CreateName<Handle(V3d_View)>(ViewerTest_myViews, "View"));
SetDisplayConnection (new Aspect_DisplayConnection ());
#endif
+ aGraphicDriver = aFactory->CreateDriver (GetDisplayConnection());
if (isVirtual)
{
// don't waste the time waiting for VSync when window is not displayed on the screen
- ViewerTest_myDefaultCaps.swapInterval = 0;
- // alternatively we can disable buffer swap at all, but this might be inappropriate for testing
- //ViewerTest_myDefaultCaps.buffersNoSwap = true;
+ aGraphicDriver->SetVerticalSync (false);
}
- aGraphicDriver = new OpenGl_GraphicDriver (GetDisplayConnection(), false);
- aGraphicDriver->ChangeOptions() = ViewerTest_myDefaultCaps;
- aGraphicDriver->InitContext();
ViewerTest_myDrivers.Bind (aViewNames.GetDriverName(), aGraphicDriver);
toCreateViewer = Standard_True;
}
else
{
- aGraphicDriver = Handle(OpenGl_GraphicDriver)::DownCast (ViewerTest_myDrivers.Find1 (aViewNames.GetDriverName()));
+ aGraphicDriver = ViewerTest_myDrivers.Find1 (aViewNames.GetDriverName());
}
//Dispose the window if input parameters are default
}
}
+//==============================================================================
+//function : VDriver
+//purpose :
+//==============================================================================
+static int VDriver (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const char** theArgVec)
+{
+ if (theArgsNb == 1)
+ {
+ theDi << "Registered: ";
+ for (Graphic3d_GraphicDriverFactoryList::Iterator aFactoryIter (Graphic3d_GraphicDriverFactory::DriverFactories());
+ aFactoryIter.More(); aFactoryIter.Next())
+ {
+ const Handle(Graphic3d_GraphicDriverFactory)& aFactory = aFactoryIter.Value();
+ theDi << aFactory->Name() << " ";
+ }
+
+ theDi << "\n";
+ theDi << "Default: ";
+ if (Handle(Graphic3d_GraphicDriverFactory) aFactory = Graphic3d_GraphicDriverFactory::DefaultDriverFactory())
+ {
+ theDi << aFactory->Name();
+ }
+ else
+ {
+ theDi << "NONE";
+ }
+ return 0;
+ }
+
+ TCollection_AsciiString aNewActive;
+ bool toLoad = false;
+ for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
+ {
+ TCollection_AsciiString anArgCase (theArgVec[anArgIter]);
+ anArgCase.LowerCase();
+ if (anArgCase == "-list")
+ {
+ for (Graphic3d_GraphicDriverFactoryList::Iterator aFactoryIter (Graphic3d_GraphicDriverFactory::DriverFactories());
+ aFactoryIter.More(); aFactoryIter.Next())
+ {
+ const Handle(Graphic3d_GraphicDriverFactory)& aFactory = aFactoryIter.Value();
+ theDi << aFactory->Name() << " ";
+ }
+ }
+ else if ((anArgCase == "-default"
+ || anArgCase == "-load")
+ && aNewActive.IsEmpty())
+ {
+ toLoad = (anArgCase == "-load");
+ if (anArgIter + 1 < theArgsNb)
+ {
+ aNewActive = theArgVec[++anArgIter];
+ }
+ else if (toLoad)
+ {
+ theDi << "Syntax error at '" << theArgVec[anArgIter] << "'";
+ return 1;
+ }
+ else
+ {
+ if (Handle(Graphic3d_GraphicDriverFactory) aFactory = Graphic3d_GraphicDriverFactory::DefaultDriverFactory())
+ {
+ theDi << aFactory->Name();
+ }
+ else
+ {
+ theDi << "NONE";
+ }
+ }
+ }
+ else if (aNewActive.IsEmpty())
+ {
+ aNewActive = theArgVec[anArgIter];
+ }
+ else
+ {
+ theDi << "Syntax error: unknown argument '" << theArgVec[anArgIter] << "'";
+ return 1;
+ }
+ }
+
+ if (!aNewActive.IsEmpty())
+ {
+ const TCollection_AsciiString aNameCopy = aNewActive;
+ if (TCollection_AsciiString::IsSameString (aNewActive, "gl", false)
+ || TCollection_AsciiString::IsSameString (aNewActive, "opengl", false)
+ || TCollection_AsciiString::IsSameString (aNewActive, "tkopengl", false))
+ {
+ aNewActive = "tkopengl";
+ }
+ else if (TCollection_AsciiString::IsSameString (aNewActive, "d3d", false)
+ || TCollection_AsciiString::IsSameString (aNewActive, "d3dhost", false)
+ || TCollection_AsciiString::IsSameString (aNewActive, "tkd3dhost", false))
+ {
+ aNewActive = "tkd3dhost";
+ }
+
+ if (toLoad)
+ {
+ if (aNewActive == "tkopengl")
+ {
+ Draw::GetInterpretor().Eval ("pload OPENGL");
+ }
+ else if (aNewActive == "tkd3dhost")
+ {
+ Draw::GetInterpretor().Eval ("pload D3DHOST");
+ }
+ else
+ {
+ theDi << "Syntax error: unable to load plugin for unknown driver factory '" << aNameCopy << "'";
+ return 1;
+ }
+ }
+
+ bool isFound = false;
+ for (Graphic3d_GraphicDriverFactoryList::Iterator aFactoryIter (Graphic3d_GraphicDriverFactory::DriverFactories());
+ aFactoryIter.More(); aFactoryIter.Next())
+ {
+ Handle(Graphic3d_GraphicDriverFactory) aFactory = aFactoryIter.Value();
+ if (TCollection_AsciiString::IsSameString (aFactory->Name(), aNewActive, false))
+ {
+ Graphic3d_GraphicDriverFactory::RegisterFactory (aFactory, true);
+ isFound = true;
+ break;
+ }
+ }
+
+ if (!isFound)
+ {
+ theDi << "Syntax error: driver factory '" << aNameCopy << "' not found";
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
//==============================================================================
//function : Vinit
//purpose : Create the window viewer and initialize all the global variable
return 0;
}
-//! Auxiliary function for parsing glsl dump level argument.
-static Standard_Boolean parseGlslSourceFlag (Standard_CString theArg,
- OpenGl_ShaderProgramDumpLevel& theGlslDumpLevel)
-{
- TCollection_AsciiString aTypeStr (theArg);
- aTypeStr.LowerCase();
- if (aTypeStr == "off"
- || aTypeStr == "0")
- {
- theGlslDumpLevel = OpenGl_ShaderProgramDumpLevel_Off;
- }
- else if (aTypeStr == "short")
- {
- theGlslDumpLevel = OpenGl_ShaderProgramDumpLevel_Short;
- }
- else if (aTypeStr == "full"
- || aTypeStr == "1")
- {
- theGlslDumpLevel = OpenGl_ShaderProgramDumpLevel_Full;
- }
- else
- {
- return Standard_False;
- }
- return Standard_True;
-}
-
-//==============================================================================
-//function : VGlDebug
-//purpose :
-//==============================================================================
-
-static int VGlDebug (Draw_Interpretor& theDI,
- Standard_Integer theArgNb,
- const char** theArgVec)
-{
- Handle(OpenGl_GraphicDriver) aDriver;
- Handle(V3d_View) aView = ViewerTest::CurrentView();
- if (!aView.IsNull())
- {
- aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aView->Viewer()->Driver());
- }
- OpenGl_Caps* aDefCaps = &ViewerTest_myDefaultCaps;
- OpenGl_Caps* aCaps = !aDriver.IsNull() ? &aDriver->ChangeOptions() : NULL;
-
- if (theArgNb < 2)
- {
- TCollection_AsciiString aDebActive, aSyncActive;
- if (aCaps == NULL)
- {
- aCaps = aDefCaps;
- }
- else
- {
- Standard_Boolean isActive = OpenGl_Context::CheckExtension ((const char* )::glGetString (GL_EXTENSIONS),
- "GL_ARB_debug_output");
- aDebActive = isActive ? " (active)" : " (inactive)";
- if (isActive)
- {
- // GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB
- aSyncActive = ::glIsEnabled (0x8242) == GL_TRUE ? " (active)" : " (inactive)";
- }
- }
-
- TCollection_AsciiString aGlslCodeDebugStatus = TCollection_AsciiString()
- + "glslSourceCode: "
- + (aCaps->glslDumpLevel == OpenGl_ShaderProgramDumpLevel_Off
- ? "Off"
- : aCaps->glslDumpLevel == OpenGl_ShaderProgramDumpLevel_Short
- ? "Short"
- : "Full")
- + "\n";
- theDI << "debug: " << (aCaps->contextDebug ? "1" : "0") << aDebActive << "\n"
- << "sync: " << (aCaps->contextSyncDebug ? "1" : "0") << aSyncActive << "\n"
- << "glslWarn: " << (aCaps->glslWarnings ? "1" : "0") << "\n"
- << aGlslCodeDebugStatus
- << "extraMsg: " << (aCaps->suppressExtraMsg ? "0" : "1") << "\n";
- return 0;
- }
-
- for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
- {
- Standard_CString anArg = theArgVec[anArgIter];
- TCollection_AsciiString anArgCase (anArg);
- anArgCase.LowerCase();
- Standard_Boolean toEnableDebug = Standard_True;
- if (anArgCase == "-glsl"
- || anArgCase == "-glslwarn"
- || anArgCase == "-glslwarns"
- || anArgCase == "-glslwarnings")
- {
- Standard_Boolean toShowWarns = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toShowWarns))
- {
- --anArgIter;
- }
- aDefCaps->glslWarnings = toShowWarns;
- if (aCaps != NULL)
- {
- aCaps->glslWarnings = toShowWarns;
- }
- }
- else if (anArgCase == "-extra"
- || anArgCase == "-extramsg"
- || anArgCase == "-extramessages")
- {
- Standard_Boolean toShow = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toShow))
- {
- --anArgIter;
- }
- aDefCaps->suppressExtraMsg = !toShow;
- if (aCaps != NULL)
- {
- aCaps->suppressExtraMsg = !toShow;
- }
- }
- else if (anArgCase == "-noextra"
- || anArgCase == "-noextramsg"
- || anArgCase == "-noextramessages")
- {
- Standard_Boolean toSuppress = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toSuppress))
- {
- --anArgIter;
- }
- aDefCaps->suppressExtraMsg = toSuppress;
- if (aCaps != NULL)
- {
- aCaps->suppressExtraMsg = toSuppress;
- }
- }
- else if (anArgCase == "-sync")
- {
- Standard_Boolean toSync = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toSync))
- {
- --anArgIter;
- }
- aDefCaps->contextSyncDebug = toSync;
- if (toSync)
- {
- aDefCaps->contextDebug = Standard_True;
- }
- }
- else if (anArgCase == "-glslsourcecode"
- || anArgCase == "-glslcode")
- {
- OpenGl_ShaderProgramDumpLevel aGslsDumpLevel = OpenGl_ShaderProgramDumpLevel_Full;
- if (++anArgIter < theArgNb
- && !parseGlslSourceFlag (theArgVec[anArgIter], aGslsDumpLevel))
- {
- --anArgIter;
- }
- aDefCaps->glslDumpLevel = aGslsDumpLevel;
- if (aCaps != NULL)
- {
- aCaps->glslDumpLevel = aGslsDumpLevel;
- }
- }
- else if (anArgCase == "-debug")
- {
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnableDebug))
- {
- --anArgIter;
- }
- aDefCaps->contextDebug = toEnableDebug;
- }
- else if (Draw::ParseOnOff (anArg, toEnableDebug)
- && (anArgIter + 1 == theArgNb))
- {
- // simple alias to turn on almost everything
- aDefCaps->contextDebug = toEnableDebug;
- aDefCaps->contextSyncDebug = toEnableDebug;
- aDefCaps->glslWarnings = toEnableDebug;
- if (!toEnableDebug)
- {
- aDefCaps->glslDumpLevel = OpenGl_ShaderProgramDumpLevel_Off;
- }
- aDefCaps->suppressExtraMsg = !toEnableDebug;
- if (aCaps != NULL)
- {
- aCaps->contextDebug = toEnableDebug;
- aCaps->contextSyncDebug = toEnableDebug;
- aCaps->glslWarnings = toEnableDebug;
- if (!toEnableDebug)
- {
- aCaps->glslDumpLevel = OpenGl_ShaderProgramDumpLevel_Off;
- }
- aCaps->suppressExtraMsg = !toEnableDebug;
- }
- }
- else
- {
- Message::SendFail() << "Syntax error at '" << anArg << "'";
- return 1;
- }
- }
-
- return 0;
-}
-
-//==============================================================================
-//function : VVbo
-//purpose :
-//==============================================================================
-
-static int VVbo (Draw_Interpretor& theDI,
- Standard_Integer theArgNb,
- const char** theArgVec)
-{
- const Standard_Boolean toSet = (theArgNb > 1);
- const Standard_Boolean toUseVbo = toSet ? (Draw::Atoi (theArgVec[1]) == 0) : 1;
- if (toSet)
- {
- ViewerTest_myDefaultCaps.vboDisable = toUseVbo;
- }
-
- // get the context
- Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
- if (aContextAIS.IsNull())
- {
- if (!toSet)
- {
- Message::SendFail ("Error: no active viewer");
- }
- return 1;
- }
- Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContextAIS->CurrentViewer()->Driver());
- if (!aDriver.IsNull())
- {
- if (!toSet)
- {
- theDI << (aDriver->Options().vboDisable ? "0" : "1") << "\n";
- }
- else
- {
- aDriver->ChangeOptions().vboDisable = toUseVbo;
- }
- }
-
- return 0;
-}
-
-//==============================================================================
-//function : VCaps
-//purpose :
-//==============================================================================
-
-static int VCaps (Draw_Interpretor& theDI,
- Standard_Integer theArgNb,
- const char** theArgVec)
-{
- OpenGl_Caps* aCaps = &ViewerTest_myDefaultCaps;
- Handle(OpenGl_GraphicDriver) aDriver;
- Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
- if (!aContext.IsNull())
- {
- aDriver = Handle(OpenGl_GraphicDriver)::DownCast (aContext->CurrentViewer()->Driver());
- aCaps = &aDriver->ChangeOptions();
- }
-
- if (theArgNb < 2)
- {
- theDI << "sRGB: " << (aCaps->sRGBDisable ? "0" : "1") << "\n";
- theDI << "VBO: " << (aCaps->vboDisable ? "0" : "1") << "\n";
- theDI << "Sprites: " << (aCaps->pntSpritesDisable ? "0" : "1") << "\n";
- theDI << "SoftMode:" << (aCaps->contextNoAccel ? "1" : "0") << "\n";
- theDI << "FFP: " << (aCaps->ffpEnable ? "1" : "0") << "\n";
- theDI << "PolygonMode: " << (aCaps->usePolygonMode ? "1" : "0") << "\n";
- theDI << "DepthZeroToOne: " << (aCaps->useZeroToOneDepth ? "1" : "0") << "\n";
- theDI << "VSync: " << aCaps->swapInterval << "\n";
- theDI << "Compatible:" << (aCaps->contextCompatible ? "1" : "0") << "\n";
- theDI << "Stereo: " << (aCaps->contextStereo ? "1" : "0") << "\n";
- theDI << "WinBuffer: " << (aCaps->useSystemBuffer ? "1" : "0") << "\n";
- theDI << "OpaqueAlpha: " << (aCaps->buffersOpaqueAlpha ? "1" : "0") << "\n";
- theDI << "NoExt:" << (aCaps->contextNoExtensions ? "1" : "0") << "\n";
- theDI << "MaxVersion:" << aCaps->contextMajorVersionUpper << "." << aCaps->contextMinorVersionUpper << "\n";
- theDI << "CompressTextures: " << (aCaps->compressedTexturesDisable ? "0" : "1") << "\n";
- return 0;
- }
-
- ViewerTest_AutoUpdater anUpdateTool (aContext, ViewerTest::CurrentView());
- for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
- {
- Standard_CString anArg = theArgVec[anArgIter];
- TCollection_AsciiString anArgCase (anArg);
- anArgCase.LowerCase();
- if (anUpdateTool.parseRedrawMode (anArg))
- {
- continue;
- }
- else if (anArgCase == "-vsync"
- || anArgCase == "-swapinterval")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->swapInterval = toEnable;
- }
- else if (anArgCase == "-ffp")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->ffpEnable = toEnable;
- }
- else if (anArgCase == "-polygonmode")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->usePolygonMode = toEnable;
- }
- else if (anArgCase == "-srgb")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->sRGBDisable = !toEnable;
- }
- else if (anArgCase == "-compressedtextures")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->compressedTexturesDisable = !toEnable;
- }
- else if (anArgCase == "-vbo")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->vboDisable = !toEnable;
- }
- else if (anArgCase == "-sprite"
- || anArgCase == "-sprites")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->pntSpritesDisable = !toEnable;
- }
- else if (anArgCase == "-depthzerotoone"
- || anArgCase == "-zerotoonedepth"
- || anArgCase == "-usezerotoonedepth"
- || anArgCase == "-iszerotoonedepth")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->useZeroToOneDepth = toEnable;
- }
- else if (anArgCase == "-softmode")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->contextNoAccel = toEnable;
- }
- else if (anArgCase == "-opaquealpha"
- || anArgCase == "-buffersOpaqueAlpha")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->buffersOpaqueAlpha = toEnable;
- }
- else if (anArgCase == "-winbuffer"
- || anArgCase == "-windowbuffer"
- || anArgCase == "-usewinbuffer"
- || anArgCase == "-usewindowbuffer"
- || anArgCase == "-usesystembuffer")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->useSystemBuffer = toEnable;
- }
- else if (anArgCase == "-accel"
- || anArgCase == "-acceleration")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->contextNoAccel = !toEnable;
- }
- else if (anArgCase == "-compat"
- || anArgCase == "-compatprofile"
- || anArgCase == "-compatible"
- || anArgCase == "-compatibleprofile")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->contextCompatible = toEnable;
- if (!aCaps->contextCompatible)
- {
- aCaps->ffpEnable = Standard_False;
- }
- }
- else if (anArgCase == "-core"
- || anArgCase == "-coreprofile")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->contextCompatible = !toEnable;
- if (!aCaps->contextCompatible)
- {
- aCaps->ffpEnable = Standard_False;
- }
- }
- else if (anArgCase == "-stereo"
- || anArgCase == "-quadbuffer")
- {
- Standard_Boolean toEnable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toEnable))
- {
- --anArgIter;
- }
- aCaps->contextStereo = toEnable;
- }
- else if (anArgCase == "-noext"
- || anArgCase == "-noextensions"
- || anArgCase == "-noextension")
- {
- Standard_Boolean toDisable = Standard_True;
- if (++anArgIter < theArgNb
- && !Draw::ParseOnOff (theArgVec[anArgIter], toDisable))
- {
- --anArgIter;
- }
- aCaps->contextNoExtensions = toDisable;
- }
- else if (anArgCase == "-maxversion"
- || anArgCase == "-upperversion"
- || anArgCase == "-limitversion")
- {
- Standard_Integer aVer[2] = { -2, -1 };
- for (Standard_Integer aValIter = 0; aValIter < 2; ++aValIter)
- {
- if (anArgIter + 1 < theArgNb)
- {
- const TCollection_AsciiString aStr (theArgVec[anArgIter + 1]);
- if (aStr.IsIntegerValue())
- {
- aVer[aValIter] = aStr.IntegerValue();
- ++anArgIter;
- }
- }
- }
- if (aVer[0] < -1
- || aVer[1] < -1)
- {
- Message::SendFail() << "Syntax error at '" << anArgCase << "'";
- return 1;
- }
- aCaps->contextMajorVersionUpper = aVer[0];
- aCaps->contextMinorVersionUpper = aVer[1];
- }
- else
- {
- Message::SendFail() << "Error: unknown argument '" << anArg << "'";
- return 1;
- }
- }
- if (aCaps != &ViewerTest_myDefaultCaps)
- {
- ViewerTest_myDefaultCaps = *aCaps;
- }
- return 0;
-}
//==============================================================================
//function : VMemGpu
const char** theArgVec)
{
Handle(V3d_View) aView = ViewerTest::CurrentView();
- if (theArgNb < 2)
+ if (aView.IsNull())
{
- if (aView.IsNull())
- {
- Message::SendFail ("Error: no active viewer");
- return 0;
- }
+ Message::SendFail ("Error: no active viewer");
+ return 0;
+ }
- Standard_Boolean isActive = ViewerTest_myDefaultCaps.contextStereo;
+ Handle(Graphic3d_Camera) aCamera = aView->Camera();
+ Graphic3d_RenderingParams* aParams = &aView->ChangeRenderingParams();
+ if (theArgNb < 2)
+ {
+ Standard_Boolean isActive = aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo;
theDI << "Stereo " << (isActive ? "ON" : "OFF") << "\n";
if (isActive)
{
return 0;
}
- Handle(Graphic3d_Camera) aCamera;
- Graphic3d_RenderingParams* aParams = NULL;
- Graphic3d_StereoMode aMode = Graphic3d_StereoMode_QuadBuffer;
- if (!aView.IsNull())
- {
- aParams = &aView->ChangeRenderingParams();
- aMode = aParams->StereoMode;
- aCamera = aView->Camera();
- }
-
+ Graphic3d_StereoMode aMode = aParams->StereoMode;
ViewerTest_AutoUpdater anUpdateTool (ViewerTest::GetAISContext(), aView);
for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
{
return 1;
}
- if (!aCamera.IsNull()
- && aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo)
+ if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo)
{
aCamera->SetProjectionType (Graphic3d_Camera::Projection_Perspective);
}
- ViewerTest_myDefaultCaps.contextStereo = Standard_False;
return 0;
}
else if (aFlag == "1"
return 1;
}
- if (!aCamera.IsNull())
- {
- aCamera->SetProjectionType (Graphic3d_Camera::Projection_Stereo);
- }
- ViewerTest_myDefaultCaps.contextStereo = Standard_True;
+ aCamera->SetProjectionType (Graphic3d_Camera::Projection_Stereo);
if (aParams->StereoMode != Graphic3d_StereoMode_OpenVR)
{
return 0;
if (aMode == Graphic3d_StereoMode_QuadBuffer)
{
- ViewerTest_myDefaultCaps.contextStereo = Standard_True;
+ Message::SendInfo() << "Warning: make sure to call 'vcaps -stereo 1' before creating a view";
}
}
else if (aFlag == "-anaglyph"
{
if (aMode == Graphic3d_StereoMode_QuadBuffer)
{
- ViewerTest_myDefaultCaps.contextStereo = Standard_True;
+ Message::SendInfo() << "Warning: make sure to call 'vcaps -stereo 1' before creating a view";
}
}
else if (anArgIter + 1 < theArgNb
}
}
- if (!aView.IsNull())
+ aParams->StereoMode = aMode;
+ aCamera->SetProjectionType (Graphic3d_Camera::Projection_Stereo);
+ if (aParams->StereoMode == Graphic3d_StereoMode_OpenVR)
{
- aParams->StereoMode = aMode;
- aCamera->SetProjectionType (Graphic3d_Camera::Projection_Stereo);
- if (aParams->StereoMode == Graphic3d_StereoMode_OpenVR)
- {
- // initiate implicit continuous rendering
- ViewerTest::CurrentEventManager()->FlushViewEvents (ViewerTest::GetAISContext(), aView, true);
- }
+ // initiate implicit continuous rendering
+ ViewerTest::CurrentEventManager()->FlushViewEvents (ViewerTest::GetAISContext(), aView, true);
}
return 0;
}
Tcl_CreateExitHandler (ViewerTest_ExitProc, 0);
const char *group = "ZeViewer";
+ theCommands.Add("vdriver",
+ "vdriver [-list] [-default DriverName] [-load DriverName]"
+ "\n\t\t: Manages active graphic driver factory."
+ "\n\t\t: Prints current active driver when called without arguments."
+ "\n\t\t: Makes specified driver active when ActiveName argument is specified."
+ "\n\t\t: -list print registered factories"
+ "\n\t\t: -default define which factory should be used by default (to be used by next vinit call)"
+ "\n\t\t: -load try loading factory plugin and set it as default one",
+ __FILE__, VDriver, group);
theCommands.Add("vinit",
"vinit [-name viewName] [-left leftPx] [-top topPx] [-width widthPx] [-height heightPx]"
"\n\t\t: [-exitOnClose] [-closeOnEscape] [-cloneActive] [-virtual {on|off}=off] [-2d_mode {on|off}=off]"
theCommands.Add ("vfps",
"vfps [framesNb=100] [-duration seconds] : estimate average frame rate for active view",
__FILE__, VFps, group);
- theCommands.Add ("vgldebug",
- "vgldebug [-sync {0|1}] [-debug {0|1}] [-glslWarn {0|1}]"
- "\n\t\t: [-glslCode {off|short|full}] [-extraMsg {0|1}] [{0|1}]"
- "\n\t\t: Request debug GL context. Should be called BEFORE vinit."
- "\n\t\t: Debug context can be requested only on Windows"
- "\n\t\t: with GL_ARB_debug_output extension implemented by GL driver!"
- "\n\t\t: -sync - request synchronized debug GL context"
- "\n\t\t: -glslWarn - log GLSL compiler/linker warnings,"
- "\n\t\t: which are suppressed by default,"
- "\n\t\t: -glslCode - log GLSL program source code,"
- "\n\t\t: which are suppressed by default,"
- "\n\t\t: -extraMsg - log extra diagnostic messages from GL context,"
- "\n\t\t: which are suppressed by default",
- __FILE__, VGlDebug, group);
- theCommands.Add ("vvbo",
- "vvbo [{0|1}] : turn VBO usage On/Off; affects only newly displayed objects",
- __FILE__, VVbo, group);
theCommands.Add ("vstereo",
"vstereo [0|1] [-mode Mode] [-reverse {0|1}]"
"\n\t\t: [-mirrorComposer] [-hmdfov2d AngleDegrees] [-unitFactor MetersFactor]"
"\n\t\t: redCyan, redCyanSimple, yellowBlue, yellowBlueSimple,"
"\n\t\t: greenMagentaSimple",
__FILE__, VStereo, group);
- theCommands.Add ("vcaps",
- "vcaps [-sRGB {0|1}] [-vbo {0|1}] [-sprites {0|1}] [-ffp {0|1}] [-polygonMode {0|1}]"
- "\n\t\t: [-compatibleProfile {0|1}] [-compressedTextures {0|1}]"
- "\n\t\t: [-vsync {0|1}] [-useWinBuffer {0|1}] [-opaqueAlpha {0|1}]"
- "\n\t\t: [-quadBuffer {0|1}] [-stereo {0|1}]"
- "\n\t\t: [-softMode {0|1}] [-noupdate|-update]"
- "\n\t\t: [-zeroToOneDepth {0|1}]"
- "\n\t\t: [-noExtensions {0|1}] [-maxVersion Major Minor]"
- "\n\t\t: Modify particular graphic driver options:"
- "\n\t\t: sRGB - enable/disable sRGB rendering"
- "\n\t\t: FFP - use fixed-function pipeline instead of"
- "\n\t\t: built-in GLSL programs"
- "\n\t\t: (requires compatible profile)"
- "\n\t\t: polygonMode - use Polygon Mode instead of built-in GLSL programs"
- "\n\t\t: compressedTexture - allow uploading of GPU-supported compressed texture formats"
- "\n\t\t: VBO - use Vertex Buffer Object (copy vertex"
- "\n\t\t: arrays to GPU memory)"
- "\n\t\t: sprite - use textured sprites instead of bitmaps"
- "\n\t\t: vsync - switch VSync on or off"
- "\n\t\t: opaqueAlpha - disable writes in alpha component of color buffer"
- "\n\t\t: winBuffer - allow using window buffer for rendering"
- "\n\t\t: zeroToOneDepth - use [0,1] depth range instead of [-1,1] range"
- "\n\t\t: Context creation options:"
- "\n\t\t: softMode - software OpenGL implementation"
- "\n\t\t: compatibleProfile - backward-compatible profile"
- "\n\t\t: quadbuffer - QuadBuffer"
- "\n\t\t: noExtensions - disallow usage of extensions"
- "\n\t\t: maxVersion - force upper OpenGL version to be used"
- "\n\t\t: Unlike vrenderparams, these parameters control alternative"
- "\n\t\t: rendering paths producing the same visual result when"
- "\n\t\t: possible."
- "\n\t\t: Command is intended for testing old hardware compatibility.",
- __FILE__, VCaps, group);
theCommands.Add ("vmemgpu",
"vmemgpu [f]: print system-dependent GPU memory information if available;"
" with f option returns free memory in bytes",
cpulimit 1000
-if { [array get Draw_Groups "Primitive building commands"] == "" } {
- pload TOPTEST
-}
-
-if { [array get Draw_Groups "ZeViewer"] == "" } {
- pload AISV
-}
+pload TOPTEST VISUALIZATION
if { [info exists imagedir] == 0 } {
- set imagedir .
+ set imagedir .
}
-if { [info exists test_image ] == 0 } {
- set test_image photo
+if { [info exists test_image] == 0 } {
+ set test_image photo
}
vinit View1
-pload XDE
-pload AISV
+pload XDE VISUALIZATION
set subgroup iges
-
-
-
-
-
-
-
-
puts "OCC172"
puts "========"
-pload XDE
+pload XDE VISUALIZATION
-# disable VBO to avoid false memory leaks reported
-# on NVidia graphics, see issue #29996
+# disable VBO to avoid false memory leaks reported on NVIDIA graphics, see issue #29996
+pload OPENGL
vcaps -vbo 0
-vinit
+vinit View1
restore [locate_data_file OCC162.brep] s
vdisplay s
puts "========"
pload VISUALIZATION
+pload OPENGL
vcaps -sprites
source $env(CSF_OCCTSamplesPath)/tcl/markers.tcl
puts "============"
puts ""
+pload MODELING VISUALIZATION
+
# enable FFP until bug-fix for GLSL
+pload OPENGL
vcaps -ffp 1
-vinit
+vinit View1
vclear
vaxo
psphere b 20
puts "========"
pload VISUALIZATION
+pload OPENGL
vcaps -sprites 0 -ffp 1
source $env(CSF_OCCTSamplesPath)/tcl/markers.tcl
vdump $imagedir/${casename}.png
puts "========"
pload VISUALIZATION
+pload OPENGL
vcaps -core
source $env(CSF_OCCTSamplesPath)/tcl/markers.tcl
vdump $imagedir/${casename}.png
puts "========"
pload VISUALIZATION
+pload OPENGL
vcaps -compatibleProfile -sprites 1 -ffp 0
source $env(CSF_OCCTSamplesPath)/tcl/markers.tcl
vdump $imagedir/${casename}.png
puts "========"
pload VISUALIZATION
+pload OPENGL
vcaps -sprites 1 -ffp 1
source $env(CSF_OCCTSamplesPath)/tcl/markers.tcl
vdump $imagedir/${casename}.png
puts "============"
-puts "CR24728"
+puts "CR24728: Test image dumping with software accelerated GL context"
puts "============"
puts ""
-############################################################
-# Test image dumping with software accelerated GL context
-############################################################
-
+pload MODELING VISUALIZATION
+pload OPENGL
vcaps -softMode 1 -ffp 1
vinit View1
#######################################################################
pload MODELING VISUALIZATION
+pload OPENGL
psphere s 0.5
tclean s
incmesh s 0.001
set anImage $imagedir/${casename}.png
-# enable FFP until bug-fix for GLSL
-vcaps -ffp 1
-
vinit View1
psphere s 10
vdisplay s
vzbufftrihedron
vdump $anImage
-vclear
-vclose View1
-
puts "Test graduated trihedron parameters"
############################################################################
-set anImage1 $imagedir/${casename}_1.png
-set anImage2 $imagedir/${casename}_2.png
-set anImage3 $imagedir/${casename}_3.png
-set anImage4 $imagedir/${casename}_4.png
-
-# enable FFP until bug-fix for GLSL
-vcaps -ffp 1
-
vinit View1
psphere s 10
vdisplay s
# Font and color parameters
vgraduatedtrihedron -on -xname X(mm) -yname Y(mm) -zname Z(mm) -xnamecolor PINK -ycolor GREENYELLOW -namefont Courier -valuesfont Courier
-vdump $anImage1
+vdump $imagedir/${casename}_1.png
# Boolean parameters
vgraduatedtrihedron -on -xdrawname off -ydrawvalues off -zdrawticks off
-vdump $anImage2
+vdump $imagedir/${casename}_2.png
# Tickmark parameters
vgraduatedtrihedron -on -xticks 10 -xticklength 15 -xvaluesoffset 20 -xnameoffset 40
-vdump $anImage3
+vdump $imagedir/${casename}_3.png
-#Arrow parameters
+# Arrow parameters
vgraduatedtrihedron -on -arrowlength 50
-vdump $anImage4
-vclose View1
-
+vdump $imagedir/${casename}_4.png
+++ /dev/null
-puts "============"
-puts "CR25854"
-puts "============"
-puts ""
-
-############################################################
-# Visualization, TKOpenGl - add option to request Core profile 3.2+
-############################################################
-
-vcaps -coreProfile
-vcaps
-vinit
-vglinfo
-box b 1 2 3
-vdisplay b
-vfit
-
-vdump $imagedir/${casename}.png
vclear
vaxo
-# Disable ffp
-vcaps -ffp 0
# draw color scale
vcolorscale cs -demo
vdump ${imagedir}/${casename}_View1.png
vdump $imagedir/${casename}_2.png
-vcaps -ffp 0
vmoveto 100 300
vmoveto 0 0
puts "============"
-puts "CR26599"
+puts "CR26599: Visualization, TKOpenGl - gradient background should reset model transformation in Core profile"
puts "============"
puts ""
-##########################################################################################
-# Visualization, TKOpenGl - gradient background should reset model transformation in Core profile
-##########################################################################################
-
-vcaps -ffp 0
-
vinit View1
vclear
vaxo
pload MODELING VISUALIZATION
# Ray-Tracing doesn't work with Compatible Profile on macOS
+pload OPENGL
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
box b 10 10 10
puts ""
pload MODELING VISUALIZATION
+pload OPENGL
vclear
vcaps -core 1
# request software OpenGL implementation - which is OpenGL 1.1 in case of Windows
# (test case is useless for other systems)
+pload OPENGL
vcaps -softMode 1
# disable FPE signals -- these often occur in software OpenGL drivers
puts ""
pload VISUALIZATION
+pload OPENGL
vcaps -vsync 0
vinit View1
vglinfo
puts ""
pload MODELING VISUALIZATION
+pload OPENGL
box b 1 2 3
vcaps -core
vclear
puts "============="
pload MODELING VISUALIZATION
+pload OPENGL
box b 1 2 3
vclear
vcaps -core
puts "OCC79"
puts "========"
-# disable VBO to avoid false memory leaks reported
-# on NVidia graphics, see issue #29996
+pload VISUALIZATION
+
+# disable VBO to avoid false memory leaks reported on NVIDIA graphics, see issue #29996
+pload OPENGL
vcaps -vbo 0
-vinit
+vinit View1
restore [locate_data_file OCC162.brep] s
vdisplay s
puts "================"
puts ""
+pload VISUALIZATION
+
# Presentation attributes
#
# Testing attribute: TPrsStd_AISPresentation
}
}
-pload TOPTEST
+pload TOPTEST VISUALIZATION
Close D -silent
-if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
- pload TOPTEST
-}
-if { [array get Draw_Groups "ZeViewer"] == "" } {
- pload AISV
-}
+pload TOPTEST VISUALIZATION
-if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
- pload TOPTEST
- pload AISV
-}
+pload TOPTEST VISUALIZATION
+
# To prevent loops limit to 10 minutes
cpulimit 600
-if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
- pload TOPTEST
- pload AISV
-}
+pload TOPTEST VISUALIZATION
+
# To prevent loops limit to 1 minutes
cpulimit 60
set bug_async ""
set bug_freenodes ""
-if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
- pload TOPTEST
-}
-if { [array get Draw_Groups "ZeViewer"] == "" } {
- pload AISV
-}
+pload TOPTEST VISUALIZATION
set group "v3d"
pload VISUALIZATION TOPTEST
+
+pload OPENGL
vgldebug -glslWarn 1
if { [info exists imagedir] == 0 } {
--- /dev/null
+puts "============"
+puts "0026392: Visualization, TKD3DHost - provide straight-forward base for integration of TKOpenGl viewer into D3D-based application"
+puts "============"
+puts ""
+
+set to_dump_screen 0
+if { ![checkplatform -windows] } {
+ puts "This test case is applicable only to Windows platform"
+ return
+}
+
+pload MODELING VISUALIZATION
+vdriver -load D3DHOST
+vclear
+vinit View1
+box b 3 0 0 1 2 3
+psphere s 1
+vdisplay -dispMode 1 b s
+set anInfo [vglinfo]
+if { [regexp {D3Dinterop} $anInfo] } {
+ puts "OK: D3Dinterop has been found"
+} else {
+ puts "Error: D3Dinterop is expected"
+}
+vfit
+vrenderparams -shadingModel PHONG
+vdump ${imagedir}/${casename}.png
-pload TOPTEST
-pload DCAF
+pload TOPTEST DCAF
cpulimit 300
set aTestName "caf003-A4"
puts ${aTestName}
+pload VISUALIZATION
+
# Set NamedShape attribute
box aBox1 100 200 300
set aLabel 0:2