Point Cloud Library (PCL)
1.8.1
surface
include
pcl
surface
3rdparty
opennurbs
opennurbs_gl.h
1
/* $NoKeywords: $ */
2
/*
3
//
4
// Copyright (c) 1993-2011 Robert McNeel & Associates. All rights reserved.
5
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6
// McNeel & Assoicates.
7
//
8
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
11
//
12
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
13
//
14
////////////////////////////////////////////////////////////////
15
*/
16
17
////////////////////////////////////////////////////////////////
18
//
19
// Definitions of ON_GL() functions that demonstrate how to
20
// use GL to display OpenNURBS objects.
21
//
22
////////////////////////////////////////////////////////////////
23
24
#include "opennurbs.h"
25
26
#if defined(ON_COMPILER_MSC)
27
28
// Tested compilers:
29
// Microsoft Developer Studio 6.0
30
// Microsoft Visual Studio 2005
31
// Support for other Windows compilers is not available.
32
33
// Windows Open GL files require windows.h to be included before the
34
// Open GL header files.
35
#include <windows.h>
36
#include <GL/gl.h>
// Open GL basic definitions
37
#include <GL/glu.h>
// Open GL utilities (for GL NURBS stuff)
38
39
#elif defined(ON_COMPILER_XCODE)
40
41
// Tested compilers:
42
// Apple XCode 2.4.1
43
// Support for other Apple compilers is not available.
44
#include <GLUT/glut.h>
// Open GL auxillary functions
45
46
#else
47
48
// Unsupported compiler:
49
// Support for other compilers is not available
50
#include <GL/gl.h>
// Open GL basic definitions
51
#include <GL/glu.h>
// Open GL utilities (for GL NURBS stuff)
52
53
#endif
54
55
56
#if !defined(OPENNURBS_GL_INC_)
57
#define OPENNURBS_GL_INC_
58
59
60
// Use ON_GL( const ON_Point, ...) to render single points.
61
void
ON_GL(
62
const
ON_Point
&
63
);
64
65
// Use ON_GL( const ON_PointCloud, ...) to render Rhino point sets.
66
void
ON_GL(
67
const
ON_PointCloud
&
68
);
69
70
// Use ON_GL( const ON_Mesh&, ...) to render OpenNURBS meshes.
71
void
ON_GL(
72
const
ON_Mesh
&
73
);
74
75
// Use ON_GL( const ON_Brep&, ...) to render OpenNURBS b-reps.
76
void
ON_GL(
77
const
ON_Brep
&,
78
GLUnurbsObj*
79
);
80
81
// must be bracketed by calls to glBegin(GL_POINTS) / glEnd()
82
void
ON_GL(
83
const
ON_3dPoint
&
84
);
85
86
void
ON_GL(
87
const
ON_Curve
&,
//
88
GLUnurbsObj*,
// created with gluNewNurbsRenderer
89
GLenum = 0,
// type of curve (if 0, type is automatically set)
90
double
[][4] = NULL
// optional transformation applied to curve
91
);
92
93
// must be bracketed by calls to gluBeginSurface( nobj )/gluEndSurface( nobj )
94
void
ON_GL(
95
const
ON_Surface
&,
//
96
GLUnurbsObj*
// created with gluNewNurbsRenderer
97
);
98
99
// Use ON_GL( const ON_NurbsCurve&,...) in place of
100
// gluNurbsCurve(). See your system's gluNurbsCurve() documentation
101
// for details. In particular, for 3d curves the call to
102
// ON_GL( const ON_NurbsCurve&, nobj,...) should appear inside
103
// of a gluBeginCurve( nobj )/gluEndCurve( nobj ) pair.
104
// Generally, the GL "type" should be set using the formula
105
// ON_NurbsCurve:IsRational()
106
// ? GL_MAP1_VERTEX_4
107
// : GL_MAP1_VERTEX_3;
108
void
ON_GL(
109
const
ON_NurbsCurve
&,
//
110
GLUnurbsObj*,
// created with gluNewNurbsRenderer
111
GLenum = 0,
// type of curve (if 0, type is automatically set)
112
int
= 1,
// bPermitKnotScaling - If true, curve knots may
113
// be rescaled to avoid knot vectors GL cannot handle.
114
double
* = NULL,
// knot_scale[2] - If not NULL and bPermitKnotScaling,
115
// the scaling applied to the knot vector is
116
// returned here.
117
double
[][4] = NULL
// optional transformation applied to curve
118
);
119
120
void
ON_GL(
// low level NURBS curve renderer
121
int
,
int
,
int
,
int
,
// dim, is_rat, cv_count, order
122
const
double
*,
// knot_vector[]
123
int
,
// cv_stride
124
const
double
*,
// cv
125
GLUnurbsObj*,
// created with gluNewNurbsRenderer
126
GLenum = 0,
// type of curve (if 0, type is automatically set)
127
int
= 1,
// bPermitKnotScaling - If true, curve knots may
128
// be rescaled to avoid knot vectors GL cannot handle.
129
double
* = NULL,
// knot_scale[2] - If not NULL and bPermitKnotScaling,
130
// the scaling applied to the knot vector is
131
// returned here.
132
double
[][4] = NULL
// optional transformation applied to curve
133
);
134
135
136
// Use ON_GL( const ON_NurbsSurface&,...) in place of
137
// gluNurbsSurface(). See your system's gluNurbsSurface() documentation
138
// for details. In particular, the call to
139
// ON_GL( const ON_NurbsSurface&, nobj, ...) should appear inside
140
// of a gluBeginSurface( nobj )/gluEndSurface( nobj ) pair.
141
// Generally, the GL "type" should be set using the formula
142
// ON_NurbsSurface:IsRational()
143
// ? GL_MAP2_VERTEX_4
144
// : GL_MAP2_VERTEX_3;
145
void
ON_GL(
146
const
ON_NurbsSurface
&,
//
147
GLUnurbsObj*,
// created with gluNewNurbsRenderer
148
GLenum = 0,
// type of surface
149
// (if 0, type is automatically set)
150
int
= 1,
// bPermitKnotScaling - If true, surface knots may
151
// be rescaled to avoid knot vectors GL cannot handle.
152
double
* = NULL,
// knot_scale0[2] - If not NULL and bPermitKnotScaling,
153
// the scaleing applied to the first parameter is
154
// returned here.
155
double
* = NULL
// knot_scale0[2] - If not NULL and bPermitKnotScaling,
156
// the scaleing applied to the second parameter is
157
// returned here.
158
);
159
160
161
// Use ON_GL( const ON_BrepFace&, nobj ) to render
162
// the trimmed NURBS surface that defines a ON_Brep face's geometry.
163
// The call to ON_GL( const ON_BrepFace&, nobj ) should
164
// appear inside of a gluBeginSurface( nobj )/gluEndSurface( nobj )
165
// pair.
166
void
ON_GL(
167
const
ON_BrepFace
&,
//
168
GLUnurbsObj*
// created with gluNewNurbsRenderer
169
);
170
171
// Use ON_GL( const ON_Color ...) to set GL color to OpenNURBS color
172
void
ON_GL(
const
ON_Color
&,
173
GLfloat[4]
174
);
175
void
ON_GL(
const
ON_Color
&,
176
double
,
// alpha
177
GLfloat[4]
178
);
179
180
// Use ON_GL( const ON_Material ...) to set GL material to OpenNURBS material
181
void
ON_GL(
182
const
ON_Material
&
183
);
184
185
void
ON_GL(
186
const
ON_Material
*
// pass NULL to get OpenNURBS's default material
187
);
188
189
// Use ON_GL( const ON_Light, ...) to add OpenNURBS spotlights to
190
// GL lighting model
191
void
ON_GL(
192
const
ON_Light
*,
// pass NULL to disable the light
193
GLenum
// GL_LIGHTi where 0 <= i <= GL_MAX_LIGHTS
194
// See glLight*() documentation for details
195
);
196
void
ON_GL(
197
const
ON_Light
&,
198
GLenum
// GL_LIGHTi where 0 <= i <= GL_MAX_LIGHTS
199
// See glLight*() documentation for details
200
);
201
202
//////////////////////////////////////////////////////////////////////////
203
// Use ON_GL( ON_Viewport& ... ) to set the GL projections to match
204
// those used in the OpenNURBS viewport.
205
206
////////////
207
//
208
// Use ON_GL( ON_Viewport&, in, int, int, int ) to specify the size of the
209
// GL window and loads the GL projection matrix (camera to clip
210
// transformation). If the aspect ratio of the GL window and
211
// ON_Viewport's frustum do not match, the viewport's frustum is
212
// adjusted to get things back to 1:1.
213
//
214
// For systems where the upper left corner of a window has
215
// coordinates (0,0) use:
216
// port_left = 0
217
// port_right = width-1
218
// port_bottom = height-1
219
// port_top = 0
220
void
ON_GL(
ON_Viewport
&,
221
int
,
int
,
// port_left, port_right (port_left != port_right)
222
int
,
int
// port_bottom, port_top (port_bottom != port_top)
223
);
224
225
////////////
226
//
227
// Use ON_GL( ON_Viewport& ) to load the GL model view matrix (world to
228
// camera transformation).
229
void
ON_GL(
const
ON_Viewport
& );
230
231
// Use ON_GL( order, cv_count, knot, bPermitScaling, glknot )
232
// to create knot vectors suitable for GL NURBS rendering.
233
void
ON_GL(
234
const
int
,
// order, ON_NurbsCurve... order
235
const
int
,
// cv_count, ON_NurbsCurve... cv count
236
const
double
*,
// knot, ON_NurbsCurve... knot vector
237
GLfloat*,
// glknot[] - GL knot vector
238
int
= 0,
// bPermitScaling - true if re-scaling is allowed
239
double
* = NULL
// scale[2] - If not NULL and bPermitScaling is true,
240
// then the scaling parameters are returned here.
241
// ( glknot = (knot = scale[0])*scale[1] )
242
);
243
244
#endif
ON_Material
Definition:
opennurbs_material.h:25
ON_BrepFace
Definition:
opennurbs_brep.h:990
ON_NurbsSurface
Definition:
opennurbs_nurbssurface.h:64
ON_Curve
Definition:
opennurbs_curve.h:88
ON_Light
Definition:
opennurbs_light.h:20
ON_Color
Definition:
opennurbs_color.h:24
ON_PointCloud
Definition:
opennurbs_pointcloud.h:26
ON_Mesh
Definition:
opennurbs_mesh.h:989
ON_Brep
Definition:
opennurbs_brep.h:1570
ON_NurbsCurve
Definition:
opennurbs_nurbscurve.h:29
ON_Viewport
Definition:
opennurbs_viewport.h:31
ON_3dPoint
Definition:
opennurbs_point.h:418
ON_Point
Definition:
opennurbs_pointgeometry.h:24
ON_Surface
Definition:
opennurbs_surface.h:44