EasyManuals Logo

HP b2600 Reference Guide

HP b2600
486 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #414 background imageLoading...
Page #414 background image
T
gluTessCallback
Chapter 18
414
GLU_TESS_COMBINE
The combine callback is called to create a new vertex when the tessellation detects an
intersection, or wishes to merge features. The function takes four arguments: an array of
three elements each of type GLdouble, an array of four pointers, an array of four
elements each of type GLfloat, and a pointer to a pointer. The prototype is:
void combine(GLdouble coords[3], void *vertex_data[4], GLfloat
weight[4], void **outData);
The vertex is defined as a linear combination of up to four existing vertices, stored in
vertex_data. The coefficients of the linear combination are given by weight; these
weights always add up to 1. All vertex pointers are valid even when some of the weights
are 0. coords gives the location of the new vertex.
The user must allocate another vertex, interpolate parameters using vertex_data and
weight, and return the new vertex pointer in outData. This handle is supplied during
rendering callbacks. The user is responsible for freeing the memory some time after
gluTessEndPolygon is called.
For example, if the polygonlies in an arbitrary plane in 3-space, and a color is associated
with each vertex, the GLU_TESS_COMBINE callback might look like this:
void myCombine(GLdouble coords[3], VERTEX *d[4],
GLfloat w[4], VERTEX **dataOut)
{
VERTEX *new = new_vertex();
new->x = coords[0];
new->y = coords[1];
new->z = coords[2];
new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r;
new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g;
new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b;
new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a;
*dataOut = new;
}
If the tessellation detects an intersection, then the GLU_TESS_COMBINE or
GLU_TESS_COMBINE_DATA callback (see below) must be defined, and it must write a
non-NULL pointer into dataOut. Otherwise the
GLU_TESS_NEED_COMBINE_CALLBACK error occurs, and no output is generated.
(This is the only error that can occur during tessellation and rendering.)
GLU_TESS_COMBINE_DATA
The same as the GLU_TESS_COMBINE callback except that it takes an additional
pointer argument. This pointer is identical to the opaque pointer provided when
gluTessBeginPolygon was called. The function prototype for this callback is:
void combineData (GLdouble coords[3], void *vertex_data[4], GLfloat
weight[4], void **outData,
void *polygon_data);

Table of Contents

Other manuals for HP b2600

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP b2600 and is the answer not in the manual?

HP b2600 Specifications

General IconGeneral
BrandHP
Modelb2600
CategoryDesktop
LanguageEnglish

Related product manuals