569 571














Open GL Super Bible:Curves and Surfaces: What the #%@!&* Are NURBS?















To access the contents, click the chapter and section titles.


Open GL Super Bible


(Publisher: Macmillan Computer Publishing)

Author(s): Waite group Press

ISBN: 1571690735

Publication Date: 08/01/96

 




Previous
Table of Contents
Next




gluNurbsCurve

Purpose
Defines the shape of a NURBS curve.
Include File
<glu.h>
Syntax
void gluNurbsCurve(GLUnurbsObj *nObj, GLint nknots, GLfloat *knot, GLint stride, GLfloat *ctlarray, GLint order, GLenum type);
Description
This function defines the shape of a NURBS
curve. The definition of this curve must be delimited by gluBeginCurve
and gluEndCurve.


Parameters

nObj

GLUnurbsObj*: Pointer to the NURBS object (created with gluNewNurbsRenderer).
nkots

GLint: The number of knots in *knots. This is the number of control points plus order.
knots

GLfloat*: An array of knot values in nondescending order.
stride

GLint: Specifies the offset, as a number of single-precision floating point values, between control points.
ctlArray

GLfloat*: Pointer to an array or data structure containing the control points for the NURBS surface.
order

GLint: The order of the NURBS surface. Order is 1 more than the degree.
type

GLenum: The type of surface. This can be any of
the two-dimensional evaluator types: GL_MAP2_VERTEX_3, GL_MAP2_VERTEX_4,
GL_MAP2_INDEX, GL_MAP2_COLOR_4, GL_MAP2_NORMAL, GL_MAP2_TEXTURE_COORD_1,
GL_MAP2_TEXTURE_COORD_2, GL_MAP2_TEXTURE_COORD_3, and
GL_MAP2_TEXTURE_COORD_4.
Returns
None.
Example
See the example for gluBeginCurve.
See Also,
gluBeginCurve,gluEndCurve, gluNurbsSurface


gluNurbsProperty

Purpose
Sets a NURBS property.
Include File
<glu.h>
Syntax
void gluNurbsProperty(GLUnurbsObj *nObj, GLenum property, GLfloat value);
Description
This function sets the properties of the NURBS object. Valid properties are as follows:

GLU_SAMPLING_TOLERANCE: Sets the maximum length in pixels to use when using the GLU_PATH_LENGTH sampling method. The default is 50.0.

GLU_DISPLAY_MODE: Defines how the NURBS surface is rendered. The value parameter may be GLU_FILL to use filled and shaded polygons, GLU_OUTLINE_POLYGON to draw just the outlines of the polygons (after tessellation), and finally GLU_OUTLINE_PATCH to draw just the outlines of user defined patches and trim curves. The default is GLU_FILL.

GLU_CULLING: The value parameter is interpreted as a Boolean value that indicates whether the NURBS curve should be discarded if its control points are outside the viewport.

GLU_PARAMETRIC_TOLERANCE: Sets the maximum pixel distance used when the sampling method is set to GLU_PARAMETRIC_ERROR. The default is 0.5. This property was introduced in GLU version 1.1.

GLU_SAMPLING_METHOD: Specifies how to tessellate the NURBS surface. This property was introduced in GLU version 1.1. The following values are valid:

GLU_PATH_LENGTH specifies that surfaces rendered with the maximum pixel length of the edges of the tessellation polygons are not greater than the value specified by GLU_SAMPLING_TOLERANCE.
GLU_PARAMETRIC_ERROR specifies that the surface is rendered with the value of GLU_PARAMETRIC_TOLERANCE designating the maximum distance, in pixels, between the tessellation polygons and the surfaces they approximate.
GLU_DOMAIN_DISTANCE specifies, in parametric
coordinates, how many sample points per unit length to take in the u
and v dimensions. The default is GLU_PATH_LENGTH.


GLU_U_STEP: Sets the number of sample points per unit length taken along the u dimension in parametric coordinates. This value is used when GLU_SAMPLING_METHOD is set to GLU_DOMAIN_DISTANCE. The default is 100. This property was introduced in GLU version 1.1.

GLU_V_STEP: Sets the number of sample points per unit length taken along the v dimension in parametric coordinates. This value is used when GLU_SAMPLING_METHOD is set to GLU_DOMAIN_DISTANCE. The default is 100. This property was introduced in GLU version 1.1.

GLU_AUTO_LOAD_MATRIX: The value parameter is
interpreted as a Boolean value. When set to GL_TRUE, it causes the NURBS
code to download the Projection matrix, the Modelview matrix, and the
viewport from the OpenGL server to compute sampling and culling matric
es for each NURBS curve. Sampling and culling matrices are required to
determine the tessellation of a NURBS surface into line segments or
polygons and to cull a NURBS surface if it lies outside of the viewport.
If this mode is set to GL_FALSE, the user needs to provide these
matrices and a viewport for the NURBS renderer to use in constructing
sampling and culling matrices. This can be done with the
gluLoadSamplingMatrices function. The default value for this mode
GL_TRUE. Changing this mode does not affect the sampling and culling
matrices until gluLoadSamplingMatrices is called.


Parameters

nObj

GLUnurbsObj*: The NURB object that is having a property modified (this is created by calling glNewNurbsRenderer).
property

GLenum: The property to be set or modified. This may be any of the following values:GLU_SAMPLING_TOLERANCE, GLU_DISPLAY_MODE, GLU_CULLING, GLU_AUTO_LOAD_MATRIX, GLU_PARAMETRIC_TOLERANCE, GLU_SAMPLING_METHOD, GLU_U_STEP, and GLU_V_STEP.
value

GLfloat: The value to which the indicated property is being set.
Returns
None.


Example
The following code from this chapterłs NURBS program sets the NURBS display property to render the surface as a wire mesh.

gluNurbsProperty(pNurb, GLU_DISPLAY_MODE, GLU_OUTLINE_POLYGON);


See Also
gluGetNurbsProperty, gluGetString,
gluLoadSamplingMatrices, gluNewNurbsRenderer






Previous
Table of Contents
Next














 


Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.












Wyszukiwarka