0022734: Memory allocation error in OpenGl
[occt.git] / src / OpenGl / OpenGl_TriangleStrip.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_TriangleStrip_Header
22#define OpenGl_TriangleStrip_Header
23
24#include <InterfaceGraphic_telem.hxx>
25#include <Graphic3d_Array1OfVertex.hxx>
26#include <Graphic3d_Array1OfVertexN.hxx>
27#include <Graphic3d_Array1OfVertexNT.hxx>
28#include <Aspect_InteriorStyle.hxx>
29
30#include <OpenGl_Element.hxx>
31
32struct TEL_TMESH_DATA
33{
34 Tint num_facets; /* Number of facets */
35 Tint facet_flag; /* TEL_FA_NONE or TEL_FA_NORMAL */
36 Tint vertex_flag;/* TEL_VT_NONE or TEL_VT_NORMAL */
37 tel_point fnormals; /* length = num_facets */
38 tel_colour fcolours; /* length = num_facets */
39 tel_point vertices; /* length = num_facets + 2 */
40 tel_colour vcolours; /* length = num_facets + 2 */
41 tel_point vnormals; /* length = num_facets + 2 */
42 tel_texture_coord vtexturecoord; /* Texture coordinates */
1c35b92f 43 DEFINE_STANDARD_ALLOC
2166f0fa
SK
44};
45
46class OpenGl_TriangleStrip : public OpenGl_Element
47{
48 public:
49
50 OpenGl_TriangleStrip (const Graphic3d_Array1OfVertex& AListVertex);
51 OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexN& AListVertex);
52 OpenGl_TriangleStrip (const Graphic3d_Array1OfVertexNT& AListVertex);
53 virtual ~OpenGl_TriangleStrip ();
54
55 virtual void Render (const Handle(OpenGl_Workspace) &AWorkspace) const;
56
57 protected:
58
59 void Init (const Tint ANbFacets, tel_point AVertices,
60 tel_point AVNormals, tel_colour AVColors, tel_texture_coord ATCoords,
61 tel_point AFNormals, tel_colour AFColors);
62
63 void draw_tmesh (const Tint, /* front_lighting_model, */
64 const Aspect_InteriorStyle, /* interior_style */
65 const TEL_COLOUR *, /* edge_colour */
66 const Handle(OpenGl_Workspace) &) const;
67
68 void draw_edges (const TEL_COLOUR *, const Aspect_InteriorStyle, Tint, const Handle(OpenGl_Workspace) &) const;
69
70 void draw_line_loop () const;
71
72 TEL_TMESH_DATA myData;
73 DS_INTERNAL *myDS;
74
75 public:
1c35b92f 76 DEFINE_STANDARD_ALLOC
2166f0fa
SK
77};
78
79#endif //OpenGl_TriangleStrip_Header