0030748: Visualization - Marker displayed in immediate layer ruins QT Quick view...
[occt.git] / src / OpenGl / OpenGl_Element.hxx
index fb89058..8a14275 100644 (file)
 #ifndef OpenGl_Element_Header
 #define OpenGl_Element_Header
 
-#include <Handle_OpenGl_Context.hxx>
-#include <Handle_OpenGl_Workspace.hxx>
 #include <OpenGl_RenderFilter.hxx>
+#include <Standard_Type.hxx>
+
+class OpenGl_Workspace;
+class OpenGl_Context;
 
 //! Base interface for drawable elements.
 class OpenGl_Element
@@ -30,11 +32,17 @@ public:
   virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const = 0;
 
   //! Release GPU resources.
-  virtual void Release (const Handle(OpenGl_Context)& theContext) = 0;
-
+  //! Pointer to the context is used because this method might be called
+  //! when the context is already being destroyed and usage of a handle
+  //! would be unsafe
+  virtual void Release (OpenGl_Context* theContext) = 0;
+
+  //! Pointer to the context is used because this method might be called
+  //! when the context is already being destroyed and usage of a handle
+  //! would be unsafe
   template <typename theResource_t>
-  static void Destroy (const Handle(OpenGl_Context)& theContext,
-                       theResource_t*&               theElement)
+  static void Destroy (OpenGl_Context* theContext,
+                       theResource_t*& theElement)
   {
     if (theElement == NULL)
     {
@@ -49,27 +57,11 @@ public:
 
 public:
 
-  //! Render element if it passes the filtering procedure. This method should
-  //! be used for elements which can be used in scope of rendering algorithms.
-  //! E.g. elements of groups during recursive rendering.
-  //! If render filter is null, pure rendering is performed.
-  //! @param theWorkspace [in] the rendering workspace.
-  //! @param theFilter [in] the rendering filter to check whether the element
-  //! should be rendered or not.
-  //! @return True if element passes the filering check and is rendered.
-  inline Standard_Boolean
-    RenderFiltered (const Handle(OpenGl_Workspace)& theWorkspace,
-                    const Handle(OpenGl_RenderFilter)& theFilter) const
-  {
-    if (!theFilter.IsNull() && !theFilter->CanRender (this))
-    {
-      return Standard_False;
-    }
-
-    Render (theWorkspace);
+  //! Return TRUE if primitive type generates shaded triangulation (to be used in filters).
+  virtual Standard_Boolean IsFillDrawMode() const { return false; }
 
-    return Standard_True;
-  }
+  //! Update parameters of the drawable elements.
+  virtual void SynchronizeAspects() {}
 
 protected: