| 1 | // File: OpenGl_PrimitiveArray.hxx |
| 2 | // Created: 13 July 2011 |
| 3 | // Author: Sergey ZERCHANINOV |
| 4 | // Copyright: OPEN CASCADE 2011 |
| 5 | |
| 6 | #ifndef OpenGl_PrimitiveArray_Header |
| 7 | #define OpenGl_PrimitiveArray_Header |
| 8 | |
| 9 | #include <OpenGl_GlCore11.hxx> |
| 10 | |
| 11 | #include <InterfaceGraphic_telem.hxx> |
| 12 | #include <Aspect_InteriorStyle.hxx> |
| 13 | |
| 14 | #include <OpenGl_Element.hxx> |
| 15 | |
| 16 | struct OPENGL_SURF_PROP; |
| 17 | class Handle(OpenGl_Context); |
| 18 | |
| 19 | class OpenGl_PrimitiveArray : public OpenGl_Element |
| 20 | { |
| 21 | public: |
| 22 | |
| 23 | //! Default constructor |
| 24 | OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray); |
| 25 | |
| 26 | //! Destructor |
| 27 | virtual ~OpenGl_PrimitiveArray(); |
| 28 | |
| 29 | //! Render primitives to the window |
| 30 | virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; |
| 31 | |
| 32 | CALL_DEF_PARRAY* PArray() const { return myPArray; } |
| 33 | |
| 34 | private: |
| 35 | |
| 36 | //! VBO initialization procedures |
| 37 | Standard_Boolean BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const; |
| 38 | void clearMemoryOwn() const; |
| 39 | void clearMemoryGL (const Handle(OpenGl_Context)& theGlContext) const; |
| 40 | Standard_Boolean checkSizeForGraphicMemory (const Handle(OpenGl_Context)& theGlContext) const; |
| 41 | |
| 42 | //! Main procedure to draw array |
| 43 | void DrawArray (Tint theLightingModel, |
| 44 | const Aspect_InteriorStyle theInteriorStyle, |
| 45 | Tint theEdgeFlag, |
| 46 | const TEL_COLOUR* theInteriorColour, |
| 47 | const TEL_COLOUR* theLineColour, |
| 48 | const TEL_COLOUR* theEdgeColour, |
| 49 | const OPENGL_SURF_PROP* theFaceProp, |
| 50 | const Handle(OpenGl_Workspace)& theWorkspace) const; |
| 51 | |
| 52 | //! Auxiliary procedures |
| 53 | void DrawEdges (const TEL_COLOUR* theEdgeColour, |
| 54 | const Handle(OpenGl_Workspace)& theWorkspace) const; |
| 55 | |
| 56 | void DrawDegeneratesAsPoints (const TEL_COLOUR* theEdgeColour, |
| 57 | const float theSkipRatio) const; |
| 58 | void DrawDegeneratesAsLines (const TEL_COLOUR* theEdgeColour, |
| 59 | const Handle(OpenGl_Workspace)& theWorkspace) const; |
| 60 | void DrawDegeneratesAsBBoxs (const TEL_COLOUR* theEdgeColour) const; |
| 61 | |
| 62 | void DrawDegeneratesPointsAsPoints() const; |
| 63 | void DrawDegeneratesLinesAsPoints() const; |
| 64 | void DrawDegeneratesLinesAsLines (const float theSkipRatio) const; |
| 65 | void DrawDegeneratesTrianglesAsPoints() const; |
| 66 | void DrawDegeneratesTrianglesAsLines (const float theSkipRatio) const; |
| 67 | void DrawDegeneratesTrianglestripsAsPoints() const; |
| 68 | void DrawDegeneratesTrianglestripsAsLines (const float theSkipRatio) const; |
| 69 | void DrawDegeneratesQuadranglesAsPoints() const; |
| 70 | void DrawDegeneratesQuadranglesAsLines (const float theSkipRatio) const; |
| 71 | void DrawDegeneratesQuadranglestripsAsPoints() const; |
| 72 | void DrawDegeneratesQuadranglestripsAsLines (const float theSkipRatio) const; |
| 73 | void DrawDegeneratesPolygonsAsPoints() const; |
| 74 | void DrawDegeneratesPolygonsAsLines (const float theSkipRatio) const; |
| 75 | |
| 76 | protected: |
| 77 | |
| 78 | mutable CALL_DEF_PARRAY* myPArray; |
| 79 | GLenum myDrawMode; |
| 80 | |
| 81 | public: |
| 82 | |
| 83 | DEFINE_STANDARD_ALLOC |
| 84 | |
| 85 | }; |
| 86 | |
| 87 | #endif //OpenGl_PrimitiveArray_Header |