Chikai Ohazama (chikai@talula)
Fri, 21 May 1999 14:25:10 -0700 (PDT)
________________________________________________________________________
Chikai J. Ohazama, Ph.D. SGI
Member of Technical Staff 2011 N. Shoreline Blvd. ms 525
Advanced Graphics Division Mountain View, CA 94043.1389
Telephone: (650) 933-6533
FAX: (650) 964-8671
On Fri, 21 May 1999, Robert Grzeszczuk wrote:
> Ricardo,
>
> Sorry, you still need to specify which indices to use for the polygon (e.g.,
> 0,1,2,3). The easist way to do it is with:
>
> voIndexedFaceSet myFaceSet(4,3,4);
> myFaceSet.appendPoly(myPolygon,4);
>
> or you can set the indices explicitly with set/get methods in the example
> below.
>
> -rg
>
>
> On May 21, 9:48am, Robert Grzeszczuk wrote:
> > Subject: Re: Problems with planes
> > Ricardo,
> >
> > No need to polygonize. You can create your own polygons to be drawn.
> >
> > For example:
> >
> > float myPolygon[] =
> > {
> > 0, 0, 0,
> > 0, 256, 0,
> > 256, 256, 64,
> > 256, 0, 64,
> > };
> >
> > voVertexData *myVertexData = new voVertexData(4,3,myPolygon);
> > voIndexedFaceSet *myFaceSet = new voIndexedFaceSet(myVertexData,4);
>
****************CODE SNIPPET**************************
void my_DrawVolume(
voIndexedTetraSet * aTetraSet, voBrickSetCollection * aVolume)
{
int brickNo;
GLdouble modelMatrix[16], projMatrix[16];
glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);
glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
float myPolygon[] =
{
0, 0, 0,
0, 256, 0,
256, 256, 64,
256, 0, 64,
};
int BrickCount = aVolume->getCurrentBrickSet()->getBrickCount();
voIndexedFaceSet myFaceSet(4,3,4);
myFaceSet.appendPoly(myPolygon,4);
// Depth sort the bricks.
voSortAction aSortAction(
aVolume->getCurrentBrickSet(), modelMatrix, projMatrix);
// Enable 2D or 3D texturing.
voAppearanceActions::textureEnable(aVolume->getInterpolationType());
// If no explicit texture coordinates were given, enable texgen().
if (!hasTextureComponent(interleavedArrayFormat))
voAppearanceActions::texgenEnable();
/* glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
*/
glColor4fv(modelColor);
// prevent Zbuffer fighting among slices
glDepthMask(GL_FALSE);
for (brickNo = 0; brickNo < BrickCount; brickNo++) {
int brickSortedNo = aSortAction[brickNo];
voBrick *aBrick = aVolume->getCurrentBrickSet()->getBrick(brickSortedNo);
// Update texgen equation for the current brick.
if (!hasTextureComponent(interleavedArrayFormat))
voAppearanceActions::texgenSetEquation(aBrick);
// load the texture from host to texture memory--unless already there
voAppearanceActions::textureBind(aBrick);
voGeometryActions::draw(
&myFaceSet,
interleavedArrayFormat);
}
}
This archive was generated by hypermail 2.0b2 on Mon Nov 01 1999 - 13:42:00 PST