0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / OpenGl / OpenGl_PrimitiveArray.hxx
... / ...
CommitLineData
1// Created on: 2011-07-13
2// Created by: Sergey ZERCHANINOV
3// Copyright (c) 2011-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and / or modify it
8// under the terms of the GNU Lesser General Public version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef OpenGl_PrimitiveArray_Header
17#define OpenGl_PrimitiveArray_Header
18
19#include <OpenGl_VertexBuffer.hxx>
20
21#include <InterfaceGraphic_Graphic3d.hxx>
22#include <Aspect_InteriorStyle.hxx>
23#include <Aspect_TypeOfMarker.hxx>
24
25#include <OpenGl_Element.hxx>
26
27struct OPENGL_SURF_PROP;
28
29class OpenGl_PrimitiveArray : public OpenGl_Element
30{
31public:
32 // OpenGL does not provie a constant for "none" draw mode.
33 // So we define our own one that does not conflict with GL constants
34 // and untilizes common GL invalid value
35 enum
36 {
37 DRAW_MODE_NONE = -1
38 };
39
40 //! Default constructor
41 OpenGl_PrimitiveArray (CALL_DEF_PARRAY* thePArray);
42
43 //! Render primitives to the window
44 virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
45
46 virtual void Release (const Handle(OpenGl_Context)& theContext);
47
48 CALL_DEF_PARRAY* PArray() const { return myPArray; }
49
50private:
51
52 Standard_Boolean toDrawVbo() const
53 {
54 return !myVbos[VBOVertices].IsNull();
55 }
56
57 //! VBO initialization procedures
58 Standard_Boolean BuildVBO (const Handle(OpenGl_Workspace)& theWorkspace) const;
59 void clearMemoryOwn() const;
60 void clearMemoryGL (const Handle(OpenGl_Context)& theGlCtx) const;
61
62 //! Main procedure to draw array
63 void DrawArray (Tint theLightingModel,
64 const Aspect_InteriorStyle theInteriorStyle,
65 Tint theEdgeFlag,
66 const TEL_COLOUR* theInteriorColour,
67 const TEL_COLOUR* theLineColour,
68 const TEL_COLOUR* theEdgeColour,
69 const OPENGL_SURF_PROP* theFaceProp,
70 const Handle(OpenGl_Workspace)& theWorkspace) const;
71
72 //! Auxiliary procedures
73 void DrawEdges (const TEL_COLOUR* theEdgeColour,
74 const Handle(OpenGl_Workspace)& theWorkspace) const;
75
76 void DrawMarkers (const Handle(OpenGl_Workspace)& theWorkspace) const;
77
78protected:
79
80 //! Destructor
81 virtual ~OpenGl_PrimitiveArray();
82
83protected:
84
85 typedef enum
86 {
87 VBOEdges,
88 VBOVertices,
89 VBOVcolours,
90 VBOVnormals,
91 VBOVtexels,
92 VBOMaxType
93 } VBODataType;
94
95 mutable CALL_DEF_PARRAY* myPArray;
96 mutable Handle(OpenGl_VertexBuffer) myVbos[VBOMaxType];
97 GLint myDrawMode;
98 mutable Standard_Boolean myIsVboInit;
99
100public:
101
102 DEFINE_STANDARD_ALLOC
103
104};
105
106#endif //OpenGl_PrimitiveArray_Header