>-----Original Message-----
>From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]] On Behalf Of Simeon H.K. Fitch
>Sent: Friday, March 22, 2002 10:58 AM
>To: [EMAIL PROTECTED]
>Subject: Re: [JAVA3D] On-the-fly object editing

>Every CAD program out there does it, so there must be a better
>way of doing it than having two copies of the same geometry.
>Any OpenGL wizzards out there know how POLYGON_FILLED_OUTLINE
>would be accomplished in OpenGL? Does DirectX have anything similar?
>Would it be hard to do it in the Java3D engine in a portable mannar?
>
>thx,
>
>Simeon

============================================


The following code is from:

SIGGRAPH '96 OpenGL programming course
http://www.sgi.com/software/opengl/advanced96/tomcat/hiddenline.c


Is that what you're looking for? If not, perhaps you should check out
the site and see if you find what you want.

John Barrus



/* do hidden line removal on an object in the scene */
/* use display lists to represent objects */
void
hiddenlineobj(GLint dlist)
{
    GLboolean tex2d;

    glGetBooleanv(GL_TEXTURE_2D, &tex2d);
    if(tex2d)
      glDisable(GL_TEXTURE_2D);
    glDisable(GL_LIGHTING);
    glColor3f(.7f, .7f, .7f);

    glEnable(GL_STENCIL_TEST);
    glStencilFunc(GL_ALWAYS, 0, 0); /* clear stencil for this object */

    glCallList(dlist); /* draw filled object in depth buffer */

    glEnable(GL_LIGHTING);
    if(tex2d)
      glEnable(GL_TEXTURE_2D);

    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); /* turn off
color */
    glDisable(GL_DEPTH_TEST); /* turn off depth */
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    glStencilFunc(GL_ALWAYS, 1, 1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);

    glCallList(dlist); /* draw lines into stencil buffer */

    glStencilFunc(GL_EQUAL, 1 , 1);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

    glCallList(dlist); /* use lines in stencil to stencil out solid
pgons */

    /* clean up state */
    glDisable(GL_STENCIL_TEST);
    glDepthFunc(GL_LESS);
}

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to