566 568














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




gluNewNurbsRenderer

Purpose
Creates a NURBS object.
Include File
<glu.h>
Syntax
GLUnurbsObj* gluNewNurbsRenderer(void);
Description
This function creates a NURBS rendering object.
This object is used to control the behavior and characteristics of NURBS
curves and surfaces. The functions that allow the NURBS properties to be
set all require this pointer. You must delete this object with gluDeleteNurbsRenderer when you are finished rendering your NURBS. Returns
A pointer to a new NURBS object. This object
will be used when you call the rendering and control functions.


Example
This code demonstrates the creation of a NURBS object:

// Setup the Nurbs object

// Start by creating it
pNurb = gluNewNurbsRenderer();

// Set NURBS properties
gluNurbsProperty(pNurb, GLU_SAMPLING_TOLERANCE, 25.0f);
gluNurbsProperty(pNurb, GLU_DISPLAY_MODE, (GLfloat)GLU_FILL);

.. other properties




See Also
gluDeleteNurbsRenderer


gluNurbsCallback

Purpose
Defines a callback for a NURBS function.
Include File
<glu.h>
Syntax
void gluNurbsCallback(GLUnurbsObj *nObj, GLenum which, void (*fn)( ));
Description
This function sets a NURBS callback function.
The only supported callback is GL_ERROR. When an error occurs, this
function is called with an argument of type GLenum. One of 37 NURBS
errors can be specified by the defines GLU_NURBS_ERROR1 -
GLU_NURBS_ERROR37. A character string definition of the error can be
retrieved with the function gluErrorString(). These are listed in Table
17-1.


Parameters

nObj

GLUnurbsObj*: Specifies the NURBS object.
which

GLEnum: Specifies the callback being defined. The only valid value is GLU_ERROR.
fn

void *(): Specifies the function that should be called for the callback.
Returns
None.


Example
The following is an example error handler for NURBS errors. Some code that installs the error handler is also shown. You can see this in the NURBS example program.

// NURBS callback error handler
void CALLBACK NurbsErrorHandler(GLenum nErrorCode)
{
char cMessage[64];

// Extract a text message of the error
strcpy(cMessage,"NURBS error occured: ");
strcat(cMessage,gluErrorString(nErrorCode));

// Display the message to the user
MessageBox(NULL,cMessage,NULL,MB_OK | MB_ICONEXCLAMATION);
}





// Setup the Nurbs object
pNurb = gluNewNurbsRenderer();

// Install error handler to notify user of NURBS errors
gluNurbsCallback(pNurb, GLU_ERROR, NurbsErrorHandler);

gluNurbsProperty(pNurb, GLU_SAMPLING_TOLERANCE, 25.0f);
Other properties



See Also
gluErrorString



Table 17-1 NURBS Error Codes



Error Code
Definition

GLU_NURBS_ERROR1
Spline order un-supported.

GLU_NURBS_ERROR2
Too few knots.

GLU_NURBS_ERROR3
Valid knot range is empty.

GLU_NURBS_ERROR4
Decreasing knot sequence knot.

GLU_NURBS_ERROR5
Knot multiplicity greater than order of spline.

GLU_NURBS_ERROR6
endcurve() must follow bgncurve().

GLU_NURBS_ERROR7
bgncurve() must precede endcurve().

GLU_NURBS_ERROR8
Missing or extra geometric data.

GLU_NURBS_ERROR9
Canłt draw pwlcurves.

GLU_NURBS_ERROR10
Missing or extra domain data.

GLU_NURBS_ERROR11
Missing or extra domain data.

GLU_NURBS_ERROR12
endtrim() must precede endsurface().

GLU_NURBS_ERROR13
bgnsurface() must precede endsurface().

GLU_NURBS_ERROR14
Curve of improper type passed as trim curve.

GLU_NURBS_ERROR15
bgnsurface() must precede bgntrim().

GLU_NURBS_ERROR16
endtrim() must follow bgntrim().

GLU_NURBS_ERROR17
bgntrim() must precede endtrim().

GLU_NURBS_ERROR18
Invalid or missing trim curve.

GLU_NURBS_ERROR19
bgntrim() must precede pwlcurve().

GLU_NURBS_ERROR20
pwlcurve referenced twice.

GLU_NURBS_ERROR21
pwlcurve and nurbscurve mixed.

GLU_NURBS_ERROR22
Improper usage of trim data type.

GLU_NURBS_ERROR23
nurbscurve referenced twice.

GLU_NURBS_ERROR24
nurbscurve and pwlcurve mixed.

GLU_NURBS_ERROR25
nurbssurface referenced twice.

GLU_NURBS_ERROR26
Invalid property.

GLU_NURBS_ERROR27
endsurface() must follow bgnsurface()

GLU_NURBS_ERROR28
Intersecting or misoriented trim curves.

GLU_NURBS_ERROR29
Intersecting trim curves.

GLU_NURBS_ERROR30
UNUSED.

GLU_NURBS_ERROR31
Unconnected trim curves.

GLU_NURBS_ERROR32
Unknown knot error.

GLU_NURBS_ERROR33
Negative vertex count encountered.

GLU_NURBS_ERROR34
Negative byte-stride encountered.

GLU_NURBS_ERROR35
Unknown type descriptor.

GLU_NURBS_ERROR36
Null control point reference.

GLU_NURBS_ERROR 37
Duplicate point on pwlcurve.







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