0023087: Upgrade of the OCCT test system
[occt.git] / src / OpenGl / OpenGl_PrimitiveArray.hxx
CommitLineData
b311480e 1// Created on: 2011-07-13
2// Created by: Sergey ZERCHANINOV
3// Copyright (c) 2011-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
2166f0fa
SK
20
21#ifndef OpenGl_PrimitiveArray_Header
22#define OpenGl_PrimitiveArray_Header
23
5f8b738e 24#include <OpenGl_GlCore11.hxx>
2166f0fa
SK
25
26#include <InterfaceGraphic_telem.hxx>
27#include <Aspect_InteriorStyle.hxx>
28
29#include <OpenGl_Element.hxx>
30
31struct OPENGL_SURF_PROP;
5f8b738e 32class Handle(OpenGl_Context);
2166f0fa
SK
33
34class OpenGl_PrimitiveArray : public OpenGl_Element
35{
36public:
1d03e66d 37 // OpenGL does not provie a constant for "none" draw mode.
38 // So we define our own one that does not conflict with GL constants
39 // and untilizes common GL invalid value
40 enum
41 {
42 DRAW_MODE_NONE = -1
43 };
2166f0fa
SK
44
45 //! Default constructor
46 OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray);
47
48 //! Destructor
49 virtual ~OpenGl_PrimitiveArray();
50
51 //! Render primitives to the window
52 virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
53
54 CALL_DEF_PARRAY* PArray() const { return myPArray; }
55
56private:
57
58 //! VBO initialization procedures
59 Standard_Boolean BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const;
60 void clearMemoryOwn() const;
61 void clearMemoryGL (const Handle(OpenGl_Context)& theGlContext) const;
62 Standard_Boolean checkSizeForGraphicMemory (const Handle(OpenGl_Context)& theGlContext) const;
63
64 //! Main procedure to draw array
65 void DrawArray (Tint theLightingModel,
66 const Aspect_InteriorStyle theInteriorStyle,
67 Tint theEdgeFlag,
68 const TEL_COLOUR* theInteriorColour,
69 const TEL_COLOUR* theLineColour,
70 const TEL_COLOUR* theEdgeColour,
71 const OPENGL_SURF_PROP* theFaceProp,
72 const Handle(OpenGl_Workspace)& theWorkspace) const;
73
74 //! Auxiliary procedures
75 void DrawEdges (const TEL_COLOUR* theEdgeColour,
76 const Handle(OpenGl_Workspace)& theWorkspace) const;
77
78 void DrawDegeneratesAsPoints (const TEL_COLOUR* theEdgeColour,
79 const float theSkipRatio) const;
80 void DrawDegeneratesAsLines (const TEL_COLOUR* theEdgeColour,
81 const Handle(OpenGl_Workspace)& theWorkspace) const;
82 void DrawDegeneratesAsBBoxs (const TEL_COLOUR* theEdgeColour) const;
83
84 void DrawDegeneratesPointsAsPoints() const;
85 void DrawDegeneratesLinesAsPoints() const;
86 void DrawDegeneratesLinesAsLines (const float theSkipRatio) const;
87 void DrawDegeneratesTrianglesAsPoints() const;
88 void DrawDegeneratesTrianglesAsLines (const float theSkipRatio) const;
89 void DrawDegeneratesTrianglestripsAsPoints() const;
90 void DrawDegeneratesTrianglestripsAsLines (const float theSkipRatio) const;
91 void DrawDegeneratesQuadranglesAsPoints() const;
92 void DrawDegeneratesQuadranglesAsLines (const float theSkipRatio) const;
93 void DrawDegeneratesQuadranglestripsAsPoints() const;
94 void DrawDegeneratesQuadranglestripsAsLines (const float theSkipRatio) const;
95 void DrawDegeneratesPolygonsAsPoints() const;
96 void DrawDegeneratesPolygonsAsLines (const float theSkipRatio) const;
97
98protected:
99
100 mutable CALL_DEF_PARRAY* myPArray;
1d03e66d 101 GLint myDrawMode;
2166f0fa
SK
102
103public:
104
1c35b92f 105 DEFINE_STANDARD_ALLOC
2166f0fa
SK
106
107};
108
109#endif //OpenGl_PrimitiveArray_Header