557 559














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




glMap

Purpose
Defines a 1D or 2D evaluator.
Include File
<gl.h>
Variations
void glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, const GLdouble *points); void glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, const GLfloat *points); void glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); void glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
Description
These functions define 1D or 2D evaluators. The
glMap1x functions are used for 1D evaluators (curves), and the glMap2x
functions are used for 2D evaluators (surfaces). Evaluators produce
vertex or other information (see the target parameter below)
evaluated along one or two dimensions of a parametric range (u and
v).


Parameters

target

GLenum: Specifies what kind of values are produced by the evaluator. Valid values for 1D and 2D evaluators are as follows:

GL_MAP1_VERTEX_3 (or GL_MAP2_VERTEX_3): Control points are three floats that represent x, y, and z coordinate values. glVertex3 commands are generated internally when the map is evaluated.

GL_MAP1_VERTEX_4 (or GL_MAP2_VERTEX_4): Control points are four floats that represent x, y, z, and w coordinate values. glVertex4 commands are generated internally when the map is evaluated.

GL_MAP1_INDEX (or GL_MAP2_INDEX): The generated control points are single floats that represent a color index value. glIndex commands are generated internally when the map is evaluated. Note: The current color index is not changed as it would be if glIndex were called directly.

GL_MAP1_COLOR_4 (or GL_MAP2_COLOR_4): The generated control points are four floats that represent red, green, blue, and alpha components. glColor4 commands are generated internally when the map is evaluated. Note: The current color is not changed as it would be if glColor4f were called directly.

GL_MAP1_NORMAL (or GL_MAP2_NORMAL): The generated control points are three floats that represent the x, y, and z components of a normal vector. glNormal commands are generated internally when the map is evaluated. Note: The current normal is not changed as it would be if glNormal were called directly.

GL_MAP1_TEXTURE_COORD_1 (or GL_MAP2_TEXTURE_COORD_1): The generated control points are single floats that represent the s texture coordinate. glTexCoord1 commands are generated internally when the map is evaluated. Note: The current texture coordinates are not changed as they would be if glTexCoord were called directly.

GL_MAP1_TEXTURE_COORD_2 (or GL_MAP2_TEXTURE_COORD_2): The generated control points are two floats that represent the s and t texture coordinates. glTexCoord2 commands are generated internally when the map is evaluated. Note: The current texture coordinates are not changed as they would be if glTexCoord were called directly.

GL_MAP1_TEXTURE_COORD_3 (or GL_MAP2_TEXTURE_COORD_3): The generated control points are three floats that represent the s, t, and r texture coordinates. glTexCoord3 commands are generated internally when the map is evaluated. Note: The current texture coordinates are not changed as they would be if glTexCoord were called directly.

GL_MAP1_TEXTURE_COORD_4 (or GL_MAP2_TEXTURE_COORD_4): The generated control points are four floats that represent the s, t, r, and q texture coordinates. glTexCoord4 commands are generated internally when the map is evaluated. Note: The current texture coordinates are not changed as they would be if glTexCoord were called directly.
u1,u2

Specifies the linear mapping of the parametric u parameter.
v1,v2

Specifies the linear mapping of the parametric v parameter. This is only used for 2D maps.
ustride, vstride

Specifies the number of floats or doubles between control points in the *points data structure. The coordinates for each point occupy consecutive memory locations, but this parameter allows the points to be spaced as needed to let the data come from an arbitrary data structure.
uorder, vorder

Specifies the number of control points in the u and v direction.
*points

A memory pointer that points to the control points. This may be a 2D or 3D array or any arbitrary data structure.
Returns
None.


Example
The following code is from the example program BEZ3D from this chapter. It establishes a quadratic Bazier spline mapping.

// The number of control points for this curve
GLint nNumPoints = 3;

GLfloat ctrlPoints[3][3][3]= {{{ -4.0f, 0.0f, 4.0f},
{ -2.0f, 4.0f, 4.0f},
{ 4.0f, 0.0f, 4.0f }},

{{ -4.0f, 0.0f, 0.0f},
{ -2.0f, 4.0f, 0.0f},
{ 4.0f, 0.0f, 0.0f }},

{{ -4.0f, 0.0f, -4.0f},
{ -2.0f, 4.0f, -4.0f},
{ 4.0f, 0.0f, -4.0f }}};




// Sets up the Bzier
// This actually only needs to be called once and could go in
// the setup function
glMap2f(GL_MAP2_VERTEX_3,
// Type of data generated
0.0f, // Lower u range
10.0f, // Upper u range
3, // Distance between points in the
data
3, // Dimension in u direction (order)
0.0f, // Lower v range
10.0f, // Upper v range
9, // Distance between points in the
data
3, // Dimension in v direction (order)
&ctrlPoints[0][0][0]); // array of control points


See Also
glBegin, glColor, glEnable, glEvalCoord,
glEvalMesh, glEvalPoint, glMapGrid, glNormal, glTexCoord, glVertex






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

Podobne podstrony:
559 562
557 (2)
559 (2)
554 557
554 557
559,6,artykul
557 562
557,5,artykul
559 563
556 559
II CSK 557 12 1

więcej podobnych podstron