]> OCCT Git - occt-copy.git/commitdiff
0031278: Visualization - display elements above transparent area
authorsshutina <sshutina@opencascade.com>
Fri, 20 Dec 2019 07:40:03 +0000 (10:40 +0300)
committerSvetlana SHUTINA <sshutina@nnov.opencascade.com>
Fri, 27 Dec 2019 08:14:19 +0000 (11:14 +0300)
23 files changed:
src/Font/Font_Rect.hxx
src/Graphic3d/Graphic3d_Aspects.cxx
src/Graphic3d/Graphic3d_Group.cxx
src/Graphic3d/Graphic3d_Layer.cxx
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_Context.hxx
src/OpenGl/OpenGl_Element.cxx
src/OpenGl/OpenGl_Element.hxx
src/OpenGl/OpenGl_Group.cxx
src/OpenGl/OpenGl_LayerList.cxx
src/OpenGl/OpenGl_LayerList.hxx
src/OpenGl/OpenGl_PrimitiveArray.cxx
src/OpenGl/OpenGl_Resource.hxx
src/OpenGl/OpenGl_Structure.cxx
src/OpenGl/OpenGl_Text.cxx
src/OpenGl/OpenGl_VertexBuffer.cxx
src/OpenGl/OpenGl_VertexBuffer.hxx
src/OpenGl/OpenGl_View_Redraw.cxx
src/OpenGl/OpenGl_Workspace.cxx
src/OpenGl/OpenGl_Workspace.hxx
tools/MessageModel/MessageModel_Actions.cxx
tools/VInspector/VInspector_ItemOpenGlLayerList.cxx
tools/VInspector/VInspector_ItemOpenGlLayerList.hxx

index 50c598a8ddab62eb7d6bed435093cacbec5912e7..630d02fdf6a292e76c94bdd3d45ba45a5f870077 100644 (file)
@@ -16,6 +16,7 @@
 #define _Font_Rect_H__
 
 #include <NCollection_Vec2.hxx>
+#include <Standard_Dump.hxx>
 
 //! Auxiliary POD structure - 2D rectangle definition.
 struct Font_Rect
@@ -76,6 +77,16 @@ struct Font_Rect
     return Top - Bottom;
   }
 
+  //! Dumps the content of me into the stream
+  void DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+  {
+    OCCT_DUMP_CLASS_BEGIN (theOStream, Font_Rect);
+  
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Left);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Right);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Top);
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Bottom);
+  }
 };
 
 #endif // _Font_Rect_H__
index 00f86b95f6dabb5a2af1e7f33280974f350c4fa3..afbda103f6255c16e0f9515047500693b097c8bb 100644 (file)
@@ -92,11 +92,12 @@ void Graphic3d_Aspects::DumpJson (Standard_OStream& theOStream, const Standard_I
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsTextZoomable);
 
   /*Aspect_InteriorStyle       myInteriorStyle;
-  Graphic3d_TypeOfShadingModel myShadingModel;
-  Graphic3d_AlphaMode          myAlphaMode;
-  Standard_ShortReal           myAlphaCutoff;
+  Graphic3d_TypeOfShadingModel myShadingModel;*/
 
-  Aspect_TypeOfLine            myLineType;
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlphaMode);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlphaCutoff);
+
+  /*Aspect_TypeOfLine            myLineType;
   Standard_ShortReal           myLineWidth;
 
   Aspect_TypeOfMarker          myMarkerType;
index 27e4f9acffd699da8a75bb46b4732a9ac560d13d..9ddd01b1abe797ee2952eace13965189d1e42b7f 100644 (file)
@@ -456,6 +456,7 @@ void Graphic3d_Group::DumpJson (Standard_OStream& theOStream, const Standard_Int
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Group);
 
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsClosed);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myContainsFacet);
 }
index 3859b60aad99fbafef11883f5b32559fab8a34cc..a76723bb705dacea02711d2540c751816652aaaa 100644 (file)
@@ -635,6 +635,7 @@ void Graphic3d_Layer::DumpJson (Standard_OStream& theOStream, const Standard_Int
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Layer);
 
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLayerId);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures);
   OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructuresNotCulled);
index 5356a4e2bc1c533604c0be1960eb31d1dd0bbded..73c09d970c0cb5bfbb54c0cf0dacde1bf08ba61d 100644 (file)
@@ -4045,7 +4045,102 @@ void OpenGl_Context::DumpJson (Standard_OStream& theOStream, const Standard_Inte
 {
   OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_Context)
 
+  //Handle(OpenGl_ResourcesMap)    mySharedResources;
+  //Handle(OpenGl_DelayReleaseMap) myDelayed;
+  //Handle(OpenGl_ResourcesStack)  myUnusedResources;
+  //OpenGl_Clipping myClippingState;
+  //void*            myGlLibHandle;
+  //NCollection_Handle<OpenGl_GlFunctions> myFuncs;
+  
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAnisoMax);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTexClamp);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxTexDim);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxTexCombined);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxDumpSizeX);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxDumpSizeY);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxClipPlanes);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxMsaaSamples);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxDrawBuffers);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxColorAttachments);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myGlVerMajor);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myGlVerMinor);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsInitialized);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsStereoBuffers);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsGlNormalizeEnabled);
+
+  //Graphic3d_TextureUnit mySpriteTexUnit;
+  
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasRayTracing);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasRayTracingTextures);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasRayTracingAdaptiveSampling);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasRayTracingAdaptiveSamplingAtomic);
+
+  //Handle(OpenGl_ShaderManager) myShaderManager;
+  //Handle(Font_TextFormatter) myDefaultFormatter;
+
+  //Handle(OpenGl_FrameStats)     myFrameStats;
+  //Handle(OpenGl_ShaderProgram)  myActiveProgram;
+  //Handle(OpenGl_TextureSet)     myActiveTextures;
+
+  //Handle(OpenGl_FrameBuffer)    myDefaultFbo;
+  //Handle(OpenGl_LineAttributes) myHatchStyles;
+
+  for (int i = 0; i < 4; i++)
+  {
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myViewport[i]);
+  }
+
+  for (int i = 0; i < 4; i++)
+  {
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myViewportVirt[i]);
+  }
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPointSpriteOrig);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRenderMode);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPolygonMode);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPolygonOffset)
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToCullBackFaces);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myReadBuffer);
+
+  //NCollection_Array1<Standard_Integer> myDrawBuffers;
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDefaultVao);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myColorMask);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAllowAlphaToCov);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAlphaToCoverage);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsGlDebugCtx);
+
+  //TCollection_AsciiString       myVendor;
+  //TColStd_PackedMapOfInteger    myFilters[6];
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myResolution);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myResolutionRatio);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLineWidthScale);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLineFeather);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRenderScale);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRenderScaleInv); 
+  
+  //OpenGl_Material               myMatFront;
+  //OpenGl_Material               myMatBack;
+
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &ModelWorldState)
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &WorldViewState)
   OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &ProjectionState)
 }
+
+// =======================================================================
+// function : DumpJsonOpenGl
+// purpose  :
+// =======================================================================
+void OpenGl_Context::DumpJsonOpenGl (Standard_OStream& theOStream, const Standard_Integer)
+{
+  GLboolean isEnableBlend = glIsEnabled (GL_BLEND);
+  GLboolean isEnableCullFace = glIsEnabled (GL_CULL_FACE);
+  GLboolean isEnableDepthTest = glIsEnabled (GL_DEPTH_TEST);
+  
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, isEnableBlend);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, isEnableCullFace);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, isEnableDepthTest);
+}
+
index a837d639794935c90581090fc3fba36b7d7f42da..001fcd34c86b3779f09e4403384b5130b207b1e3 100644 (file)
@@ -864,6 +864,9 @@ public: //! @name methods to alter or retrieve current state
 
   //! Dumps the content of me into the stream
   Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+    
+  //! Dumps the content of openGL into the stream
+  static Standard_EXPORT void DumpJsonOpenGl (Standard_OStream& theOStream, const Standard_Integer theDepth = -1);
 
 private:
 
index 0d5c53f5d5b868386a95753c9fbf7fa9d35b2660..2e708a88021ec4117ea51959a833460fc6428235 100755 (executable)
@@ -15,6 +15,8 @@
 
 #include <OpenGl_Element.hxx>
 
+#include <Standard_Dump.hxx>
+
 // =======================================================================
 // function : OpenGl_Element
 // purpose  :
@@ -32,3 +34,12 @@ OpenGl_Element::~OpenGl_Element()
 {
   //
 }
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void OpenGl_Element::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+{
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, this);
+}
index fe2c4e7f6057c4cafdd2d9a2b09d7eb3a687a1e8..dc2aee9cb2d4d829e18e0a0f87f652cb683fab8f 100644 (file)
@@ -64,8 +64,7 @@ public:
   virtual void SynchronizeAspects() {}
 
   //! Dumps the content of me into the stream
-  virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const
-  { (void)theOStream; (void)theDepth; }
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
 
 protected:
 
index 93a9f919976f7eabd43c97beec750c91332bb494..1fe886273fb21d55300937256cd34aba5cf843a7 100644 (file)
 #include <Graphic3d_AspectFillCapping.hxx>
 #include <Graphic3d_GroupDefinitionError.hxx>
 
+#define DEBUG_INFO
+#ifdef DEBUG_INFO
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif // DEBUG_INFO
+
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Group,Graphic3d_Group)
 
 namespace
@@ -298,12 +304,26 @@ void OpenGl_Group::AddElement (OpenGl_Element* theElem)
 // =======================================================================
 void OpenGl_Group::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
 {
+
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  
+  Standard_SStream aGroupStream;
+  DumpJson (aGroupStream);
+  MESSAGE_INFO_OBJECT(this, aGroupStream, "OpenGl_Group::Render", "", &aPerfMeter, NULL)
+  Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+
+  Standard_SStream aContextStream;
+  theWorkspace->GetGlContext()->DumpJson (aContextStream);
+  MESSAGE_INFO_OBJECT(this, aContextStream, "Context", "", &aPerfMeter, aParentAlert)
+#endif
+
   // Setup aspects
   theWorkspace->SetAllowFaceCulling (myIsClosed
                                  && !theWorkspace->GetGlContext()->Clipping().IsClippingOrCappingOn());
   const OpenGl_Aspects* aBackAspects = theWorkspace->Aspects();
   const bool isAspectSet = myAspects != NULL && renderFiltered (theWorkspace, myAspects);
-
+  
   // Render group elements
   for (OpenGl_ElementNode* aNodeIter = myFirst; aNodeIter != NULL; aNodeIter = aNodeIter->next)
   {
index aaefd64dd589d1b715103f9df86e05cbae41e82b..f1188f5847bc23bf5006554e90b3851a7c3ad873 100644 (file)
 
 #include <Graphic3d_GraphicDriver.hxx>
 
+#define DEBUG_INFO
+#ifdef DEBUG_INFO
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
+
 namespace
 {
   //! Auxiliary class extending sequence iterator with index.
@@ -172,6 +178,38 @@ void OpenGl_LayerList::SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBui
   }
 }
 
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void OpenGl_LayerList::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_LayerList);
+
+  for (NCollection_List<Handle(Graphic3d_Layer)>::Iterator aLayersIt (myLayers); aLayersIt.More(); aLayersIt.Next())
+  {
+    Handle(Graphic3d_Layer) aLayerId = aLayersIt.Value();
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aLayerId.get());
+  }
+
+
+  /*
+  NCollection_List<Handle(Graphic3d_Layer)> myLayers;
+  NCollection_DataMap<Graphic3d_ZLayerId, Handle(Graphic3d_Layer)> myLayerIds;
+  Handle(Select3D_BVHBuilder3d) myBVHBuilder;      //!< BVH tree builder for frustom culling
+  */
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbPriorities);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbStructures);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myImmediateNbStructures);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModifStateOfRaytraceable);
+
+  /*
+  //! Collection of references to layers with transparency gathered during rendering pass.
+  mutable OpenGl_LayerStack myTransparentToProcess;
+  */
+}  
+
 //=======================================================================
 //function : InsertLayerBefore
 //purpose  :
@@ -548,6 +586,11 @@ void OpenGl_LayerList::renderLayer (const Handle(OpenGl_Workspace)& theWorkspace
                                     const OpenGl_GlobalLayerSettings& theDefaultSettings,
                                     const Graphic3d_Layer& theLayer) const
 {
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_LayerList::renderLayer", "", &aPerfMeter, NULL)
+#endif
+
   const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
 
   const Graphic3d_ZLayerSettings& aLayerSettings = theLayer.LayerSettings();
@@ -856,6 +899,11 @@ void OpenGl_LayerList::renderTransparent (const Handle(OpenGl_Workspace)&   theW
     return;
   }
 
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_LayerList::renderTransparent", "", &aPerfMeter, NULL)
+#endif
+
   const Handle(OpenGl_Context) aCtx            = theWorkspace->GetGlContext();
   const Handle(OpenGl_ShaderManager)& aManager = aCtx->ShaderManager();
   OpenGl_View* aView = theWorkspace->View();
index 2d8c9024ffbda5c2722de9d7ab4b7cf0a90b2836..a1205e7e7c5ca3d562c99d5d28f40148b4df7a78 100644 (file)
@@ -126,6 +126,9 @@ public:
   //! Assigns BVH tree builder for frustom culling.
   void SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder);
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 protected:
 
   //! Stack of references to existing layers of predefined maximum size.
index 5af53c0b6cbb53ff5ab2acd3b20d533f5aa35475..93473710cdaab271f7b5b546d35d211995cc1b89 100644 (file)
 #include <Graphic3d_TextureParams.hxx>
 #include <NCollection_AlignedAllocator.hxx>
 
+#define DEBUG_INFO
+#ifdef DEBUG_INFO
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif // DEBUG_INFO
+
 namespace
 {
   //! Convert data type to GL info
@@ -769,6 +775,13 @@ void OpenGl_PrimitiveArray::Render (const Handle(OpenGl_Workspace)& theWorkspace
     return;
   }
 
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  Standard_SStream aGroupStream;
+  DumpJson (aGroupStream);
+  MESSAGE_INFO_STREAM(aGroupStream, "OpenGl_PrimitiveArray::Render", Standard_Dump::GetPointerInfo(this), &aPerfMeter, NULL)
+#endif
+
   const OpenGl_Aspects* anAspectFace = theWorkspace->ApplyAspects();
   const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
 
index 452e0182f40efa28e6dcd1a10cf9b5bd7c4154cf..f4e15a319a596d3f05d09028036502f6adf67f56 100644 (file)
@@ -48,6 +48,10 @@ public:
   //! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
   virtual Standard_Size EstimatedDataSize() const = 0;
 
+  //! Dumps the content of me into the stream
+  virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const 
+  { (void)theOStream; (void)theDepth; };
+
 private:
 
   //! Copy should be performed only within Handles!
index ec0f6282d95967f58e247cf84eea77ca5fd91d64..f81e5eedc20d759ea6f050c3eb60390bce8f8ce2 100644 (file)
 #include <OpenGl_View.hxx>
 #include <OpenGl_Workspace.hxx>
 
+#define DEBUG_INFO
+#ifdef DEBUG_INFO
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
+
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Structure,Graphic3d_CStructure)
 
 // =======================================================================
@@ -383,6 +389,9 @@ void OpenGl_Structure::Clear (const Handle(OpenGl_Context)& theGlCtx)
 void OpenGl_Structure::renderGeometry (const Handle(OpenGl_Workspace)& theWorkspace,
                                        bool&                           theHasClosed) const
 {
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_Structure::renderGeometry", "", &aPerfMeter, NULL)
+
   if (myInstancedStructure != NULL)
   {
     myInstancedStructure->renderGeometry (theWorkspace, theHasClosed);
index c3ddf5fec4c53176bad7ec1df65d2b7cdcb1ec2e..eaf07a1d76909be461b21dcf842496ad4b9bb019 100644 (file)
 #include <Graphic3d_TransformUtils.hxx>
 #include <TCollection_HAsciiString.hxx>
 
+#define DEBUG_INFO
+#ifdef DEBUG_INFO
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
+
 namespace
 {
   static const OpenGl_Mat4d THE_IDENTITY_MATRIX;
@@ -279,7 +285,25 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
 // =======================================================================
 void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
 {
+
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+
+  Standard_SStream aGroupStream;
+  DumpJson (aGroupStream);
+  MESSAGE_INFO_STREAM (aGroupStream, "OpenGl_Text::Render", "", &aPerfMeter, NULL)
+  Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
+
   const OpenGl_Aspects* aTextAspect = theWorkspace->ApplyAspects();
+  aGroupStream.str("");
+  aTextAspect->DumpJson (aGroupStream);
+  MESSAGE_INFO_STREAM (aGroupStream, "aTextAspect", "", &aPerfMeter, aParentAlert)
+
+  aGroupStream.str("");
+  OpenGl_Context::DumpJsonOpenGl (aGroupStream);
+  MESSAGE_INFO_STREAM (aGroupStream, "openGl_parameters1", "", &aPerfMeter, aParentAlert)
+#endif
+
   const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
   const Handle(OpenGl_TextureSet) aPrevTexture = aCtx->BindTextures (Handle(OpenGl_TextureSet)());
 
@@ -315,6 +339,12 @@ void OpenGl_Text::Render (const Handle(OpenGl_Workspace)& theWorkspace) const
   {
     glEnable (GL_DEPTH_TEST);
   }
+
+#ifdef DEBUG_INFO
+  aGroupStream.str("");
+  OpenGl_Context::DumpJsonOpenGl (aGroupStream);
+  MESSAGE_INFO_STREAM (aGroupStream, "openGl_parameters2", "", &aPerfMeter, aParentAlert)
+#endif
 }
 
 // =======================================================================
@@ -326,7 +356,7 @@ void OpenGl_Text::Render (const Handle(OpenGl_Context)& theCtx,
                           unsigned int theResolution) const
 {
 #if !defined(GL_ES_VERSION_2_0)
-  const Standard_Integer aPrevPolygonMode  = theCtx->SetPolygonMode (GL_FILL);
+  const Standard_Integer aPrevPolygonMode  = theCtx->SetPolygonMode (GL_FILL && GL_LINE && GL_POINT);
   const bool             aPrevHatchingMode = theCtx->SetPolygonHatchEnabled (false);
 #endif
 
@@ -613,6 +643,14 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
     return;
   }
 
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+
+  Standard_SStream aGroupStream;
+  OpenGl_Context::DumpJsonOpenGl (aGroupStream);
+  MESSAGE_INFO_STREAM (aGroupStream, "openGl_parameters3", "", &aPerfMeter, NULL)
+#endif
+
   // Note that using difference resolution in different Views in same Viewer
   // will lead to performance regression (for example, text will be recreated every time).
   const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)myText->Height(), theResolution);
@@ -768,10 +806,10 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
     }
     case Aspect_TODT_SHADOW:
     {
-      BackPolygonOffsetSentry aPolygonOffsetTmp (hasDepthTest ? theCtx : Handle(OpenGl_Context)());
-      theCtx->SetColor4fv (theColorSubs);
-      setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, -1.0f, 0.0f));
-      drawText    (theCtx, theTextAspect);
+      //BackPolygonOffsetSentry aPolygonOffsetTmp (hasDepthTest ? theCtx : Handle(OpenGl_Context)());
+      //theCtx->SetColor4fv (theColorSubs);
+      //setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (+1.0f, -1.0f, 0.0f));
+      //drawText    (theCtx, theTextAspect);
       break;
     }
     case Aspect_TODT_DIMENSION:
@@ -781,6 +819,12 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
     }
   }
 
+#ifdef DEBUG_INFO
+  aGroupStream.str("");
+  OpenGl_Context::DumpJsonOpenGl (aGroupStream);
+  MESSAGE_INFO_STREAM (aGroupStream, "openGl_parameters4", "", &aPerfMeter, NULL)
+#endif
+
   // main draw call
   theCtx->SetColor4fv (theColorText);
   setupMatrix (theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.0f));
@@ -792,6 +836,12 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
     theCtx->ApplyProjectionMatrix();
   }
 
+#ifdef DEBUG_INFO
+  aGroupStream.str("");
+  OpenGl_Context::DumpJsonOpenGl (aGroupStream);
+  MESSAGE_INFO_STREAM (aGroupStream, "openGl_parameters5", "", &aPerfMeter, NULL)
+#endif
+
 #if !defined(GL_ES_VERSION_2_0)
   if (theCtx->core11 != NULL)
   {
@@ -814,16 +864,16 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
   #endif
     const bool aColorMaskBack = theCtx->SetColorMask (false);
 
-    glClear (GL_STENCIL_BUFFER_BIT);
-    glEnable (GL_STENCIL_TEST);
-    glStencilFunc (GL_ALWAYS, 1, 0xFF);
-    glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
+    //glClear (GL_STENCIL_BUFFER_BIT);
+    //glEnable (GL_STENCIL_TEST);
+    //glStencilFunc (GL_ALWAYS, 1, 0xFF);
+    //glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
 
-    drawRect (theCtx, theTextAspect, OpenGl_Vec4 (1.0f, 1.0f, 1.0f, 1.0f));
+    //drawRect (theCtx, theTextAspect, OpenGl_Vec4 (1.0f, 1.0f, 1.0f, 1.0f));
 
-    glStencilFunc (GL_ALWAYS, 0, 0xFF);
+    //glStencilFunc (GL_ALWAYS, 0, 0xFF);
 
-    theCtx->SetColorMask (aColorMaskBack);
+    //theCtx->SetColorMask (aColorMaskBack);
   }
 
   // reset OpenGL state
@@ -850,13 +900,23 @@ void OpenGl_Text::DumpJson (Standard_OStream& theOStream, const Standard_Integer
 
   //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get());
   //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel);
+
   //Handle(Graphic3d_Text)                                  myText;     //!< text parameters
   //mutable Handle(OpenGl_Font)                             myFont;
+  
   //mutable NCollection_Vector<GLuint>                      myTextures;   //!< textures' IDs
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTextures.Size());
+
   //mutable NCollection_Vector<Handle(OpenGl_VertexBuffer)> myVertsVbo;   //!< VBOs of vertices
-  //mutable NCollection_Vector<Handle(OpenGl_VertexBuffer)> myTCrdsVbo;   //!< VBOs of texture coordinates
+  for (NCollection_Vector<Handle(OpenGl_VertexBuffer)>::Iterator aCrdsIt (myTCrdsVbo); aCrdsIt.More(); aCrdsIt.Next())
+  {
+    Handle(OpenGl_VertexBuffer) aVertexBuffer = aCrdsIt.Value();
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aVertexBuffer.get());
+  }
   //mutable Handle(OpenGl_VertexBuffer)                     myBndVertsVbo;//!< VBOs of vertices for bounding box
-  //mutable Font_Rect                                       myBndBox;
+  
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox);
+
   //mutable OpenGl_Mat4d myProjMatrix;
   //mutable OpenGl_Mat4d myModelMatrix;
   //mutable OpenGl_Mat4d myOrientationMatrix;
index 560ccebd6647c963ca7f14bccd4a6064f873f1e8..1d4034c3a181de7d7e51b38166408bdf8bed1a9a 100644 (file)
@@ -250,3 +250,20 @@ void OpenGl_VertexBuffer::unbindFixedColor (const Handle(OpenGl_Context)& theCtx
   theCtx->ShaderManager()->UpdateMaterialState();
 }
 #endif
+
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void OpenGl_VertexBuffer::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_VertexBuffer)
+
+  OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myOffset);
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBufferId);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myComponentsNb);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myElemsNb);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDataType);
+}
index 5f259ef7c0175ecf3f78ac7278d2c960f6bbb0a5..5e012681fb96b097e529a6bbf8615746b370f877 100644 (file)
@@ -336,6 +336,9 @@ public: //! @name methods for interleaved attributes array
   //! Unbind all vertex attributes. Default implementation does nothing.
   Standard_EXPORT virtual void UnbindAllAttributes (const Handle(OpenGl_Context)& theGlCtx) const;
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+
 protected:
 
   GLubyte* myOffset;       //!< offset to data
index 5f83913b0d26f907e699208d5b0667e2d83a30ff..c4a54e30baa5031f9159ffa76724ddd9f5329aea 100644 (file)
 #include <OpenGl_Structure.hxx>
 #include <OpenGl_ArbFBO.hxx>
 
+#define DEBUG_INFO
+#ifdef DEBUG_INFO
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif
+
 namespace
 {
   //! Format Frame Buffer format for logging messages.
@@ -175,6 +181,11 @@ void OpenGl_View::Redraw()
     return;
   }
 
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_View::Redraw", "", &aPerfMeter, NULL)
+#endif
+
   myWindow->SetSwapInterval();
 
   ++myFrameCounter;
@@ -614,6 +625,11 @@ void OpenGl_View::RedrawImmediate()
     return;
   }
 
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_View::RedrawImmediate", "", &aPerfMeter, NULL)
+#endif
+
   const Graphic3d_StereoMode   aStereoMode  = myRenderParams.StereoMode;
   Graphic3d_Camera::Projection aProjectType = myCamera->ProjectionType();
   OpenGl_FrameBuffer*          aFrameBuffer = myFBO.get();
@@ -771,6 +787,12 @@ void OpenGl_View::redraw (const Graphic3d_Camera::Projection theProjection,
                           OpenGl_FrameBuffer*                theReadDrawFbo,
                           OpenGl_FrameBuffer*                theOitAccumFbo)
 {
+
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_View::redraw", "", &aPerfMeter, NULL)
+#endif
+
   Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
   if (theReadDrawFbo != NULL)
   {
@@ -817,6 +839,11 @@ bool OpenGl_View::redrawImmediate (const Graphic3d_Camera::Projection theProject
                                    OpenGl_FrameBuffer*                theOitAccumFbo,
                                    const Standard_Boolean             theIsPartialUpdate)
 {
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_View::redrawImmediate", "", &aPerfMeter, NULL)
+#endif
+
   Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
   GLboolean toCopyBackToFront = GL_FALSE;
   if (theDrawFbo == theReadFbo
@@ -893,6 +920,11 @@ void OpenGl_View::render (Graphic3d_Camera::Projection theProjection,
   //      Step 1: Prepare for render
   // ==================================
 
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_View::render", "", &aPerfMeter, NULL)
+#endif
+
   const Handle(OpenGl_Context)& aContext = myWorkspace->GetGlContext();
   aContext->SetAllowSampleAlphaToCoverage (myRenderParams.ToEnableAlphaToCoverage
                                         && theOutputFBO != NULL
@@ -1103,6 +1135,11 @@ void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
   if ( myZLayers.NbStructures() <= 0 )
     return;
 
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_View::renderStructs", "", &aPerfMeter, NULL)
+#endif
+
   Handle(OpenGl_Context) aCtx = myWorkspace->GetGlContext();
   Standard_Boolean toRenderGL = theToDrawImmediate ||
     myRenderParams.Method != Graphic3d_RM_RAYTRACING ||
@@ -1226,6 +1263,12 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
                                OpenGl_FrameBuffer*          theOitAccumFbo,
                                const Standard_Boolean       theToDrawImmediate)
 {
+
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+  MESSAGE_INFO("OpenGl_View::renderScene", "", &aPerfMeter, NULL)
+#endif
+
   const Handle(OpenGl_Context)& aContext = myWorkspace->GetGlContext();
 
   // Specify clipping planes in view transformation space
index adfc4902da40f0e58f79e3d5d79c8467b7bce669..d05046ea25bae0a689d8c44710e4b36886314654 100644 (file)
 #include <Graphic3d_TransformUtils.hxx>
 #include <NCollection_AlignedAllocator.hxx>
 
+#define DEBUG_INFO
+#ifdef DEBUG_INFO
+#include <Message_Alerts.hxx>
+#include <Message_PerfMeter.hxx>
+#endif // DEBUG_INFO
+
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Workspace,Standard_Transient)
 
 namespace
@@ -401,6 +407,14 @@ Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)&
 // =======================================================================
 bool OpenGl_Workspace::ShouldRender (const OpenGl_Element* theElement)
 {
+#ifdef DEBUG_INFO
+  Message_PerfMeter aPerfMeter;
+
+  Standard_SStream aWorkspaceStream;
+  DumpJson (aWorkspaceStream);
+  MESSAGE_INFO_OBJECT(this, aWorkspaceStream, "Workspace", "", &aPerfMeter, NULL)
+#endif
+
   // render only non-raytracable elements when RayTracing is enabled
   if ((myRenderFilter & OpenGl_RenderFilter_NonRaytraceableOnly) != 0)
   {
@@ -447,3 +461,41 @@ bool OpenGl_Workspace::ShouldRender (const OpenGl_Element* theElement)
   }
   return true;
 }
+
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void OpenGl_Workspace::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const
+{
+  OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_Workspace);
+
+  //OpenGl_View*           myView;
+  //Handle(OpenGl_Window)  myWindow;
+  //Handle(OpenGl_Context) myGlContext;
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUseZBuffer);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUseDepthWrite);
+  
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myNoneCulling);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFrontCulling);
+  
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNbSkippedTranspElems);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myRenderFilter);
+  
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myDefaultAspects);
+
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspectsSet);
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspectsApplied.get());
+  //Handle(Graphic3d_PresentationAttributes) myAspectFaceAppliedWithHL;
+
+  //const OpenGl_Matrix* ViewMatrix_applied;
+  //const OpenGl_Matrix* StructureMatrix_applied;
+  
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToAllowFaceCulling);
+  //Handle(Graphic3d_PresentationAttributes) myHighlightStyle;
+  //OpenGl_Matrix myModelViewMatrix;
+  
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAspectFaceHl);
+  //Handle(OpenGl_TextureSet) myEnvironmentTexture;
+}
index 3a6974e1158512f6bc97e06df9dd37fcdada4a00..1c87f9729f069012e1558438c9f032f5bb760b97 100644 (file)
@@ -194,6 +194,9 @@ public:
   //! Returns environment texture.
   const Handle(OpenGl_TextureSet)& EnvironmentTexture() const { return myEnvironmentTexture; }
 
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const;
+  
 protected: //! @name protected fields
 
   OpenGl_View*           myView;
index 0b56179b08fd102493c31e8aa45c9c9f1682aa7a..82f9268da86b659cc034bef2a81511d65f0bf3f0 100644 (file)
@@ -419,6 +419,15 @@ void MessageModel_Actions::OnTestPropertyPanel()
     MESSAGE_INFO_STREAM(aStream, "Quantity_Color", "", &aPerfMeter, NULL);
   }
 
+  // stream of some table values
+  {
+    Standard_SStream aStream;
+    OCCT_DUMP_FIELD_VALUES_NUMERICAL (aStream, "value_1", 1, 100);
+    OCCT_DUMP_FIELD_VALUES_STRING (aStream, "value_2", 2, "value_1", "value_2");
+
+    MESSAGE_INFO_STREAM(aStream, "Table: Name to value", "", &aPerfMeter, NULL);
+  }
+
   // SHAPE messages
   {
     BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
index 53e3e76f3c6d635db2b424fd0f114a712a133de6..11b2bb6551215ad62b8819a379620c72385e1d11 100644 (file)
@@ -153,6 +153,20 @@ QVariant VInspector_ItemOpenGlLayerList::initValue (const int theItemRole) const
   }
   return QVariant();
 }
+// ======================================================================
+// function : initStream
+// purpose :
+// =======================================================================
+void VInspector_ItemOpenGlLayerList::initStream (Standard_OStream& theOStream) const
+{
+  Standard_Boolean isDefault;
+  const OpenGl_LayerList& aListOfLayers = GetLayerList (isDefault);
+  if (isDefault)
+    return;
+  aListOfLayers.DumpJson (theOStream);
+}
+
 
 // =======================================================================
 // function : createChild
index ef020efa825e959a873f99e6b79bbcf5730c7f67..e7598b659c92792e6f9c84960ed2092dd64f865f 100644 (file)
@@ -72,6 +72,10 @@ protected:
   //! \return the value
   Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
 
+  //! Returns stream value of the item to fulfill property panel.
+  //! \return stream value or dummy
+  Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const;
+
 protected:
 
   //! Creates a child item in the given position.