0024250: TKOpenGl - per-pixel lighting using GLSL program (Phong shading)
[occt.git] / src / OpenGl / OpenGl_GraphicDriver.hxx
index fa7d4ae..fe53540 100644 (file)
@@ -81,6 +81,21 @@ class OpenGl_Element;
 class OpenGl_Structure;
 class OpenGl_Text;
 
+//! Tool class to implement consistent state counter
+//! for objects inside the same driver instance.
+class OpenGl_StateCounter
+{
+public:
+
+  OpenGl_StateCounter() : myCounter (0) { }
+
+  Standard_Size Increment() { return ++myCounter; }
+
+private:
+  
+  Standard_Size myCounter;
+};
+
 //! This class defines an OpenGl graphic driver <br>
 class OpenGl_GraphicDriver : public Graphic3d_GraphicDriver
 {
@@ -351,6 +366,14 @@ private:
   OpenGl_UserDrawCallback_t                                       myUserDrawCallback;
   OpenGl_Text*                                                    myTempText;         //!< variable for compatibility (drawing text in layers)
 
+public:
+
+  OpenGl_StateCounter* GetStateCounter() const { return &myStateCounter; }
+
+private:
+
+  mutable OpenGl_StateCounter myStateCounter;
+
 };
 
 #endif //_OpenGl_GraphicDriver_HeaderFile