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