Our capability matches OpenGL.  To do this in OpenGL, you need to
render the polygon twice - once in fill mode and once in line mode.
There are a couple of problems with this.  In line mode, the polygon
edges are drawn as defined by the OpenGL specification.  Often, this isn't
what the applications wants.  It will show interior edges of a triangle
strip or fan for example.  It is also not as fast as it could be.  Rendering
a polygon in line mode follows all the rendering semantics of a polygon, and
at the very end, it is converted into lines.  This is a slower method, and
most hardware slows down when doing this.  We didn't want to force this
semantic on applications, so we provided the facility without enforcing
a policy.

A faster and more flexible approach is to create a line array object that
represents the outline you want and use it.  Hardware can render lines much
faster than polygons in line mode.  This will create more scene
graph in the application, but in the end, the application will most likely
get what it wants.

To work around the Z buffer fighting, use polygon offset.

Doug Twilleager
Sun Microsystems

>X-Sender: [EMAIL PROTECTED]
>Mime-Version: 1.0
>Subject: Re: [JAVA3D] FW: [JAVA3D] border on polygons
>To: [EMAIL PROTECTED]
>
>Daniel,
>
>This capability is already there, though it's a bit obfuscated now and the
>J3D team could help us out here--assuming that this workaround will work.
>
>The PolygonAttributes class allows you to define the rasterization of a
>polygon, in other words, how the polygon is represented on the screen. The
>options are:
>
>POLYGON_POINT - the polygon is rendered as points drawn at the vertices.
>POLYGON_LINE - the polygon is rendered as lines drawn between consecutive
>vertices.
>POLYGON_FILL - the polygon is rendered by filling the interior between the
>vertices. The default mode.
>
>You are essentially looking for a combination of POLYGON_FILL and
>POLYGON_LINE.  This *is* something that is supported directly by OpenGL but
>for some reason J3D isn't supporting it.
>
>I think a workaround (SUN J3D TEAM PLEASE VERIFY) would be to
>
>1)  Make a complete copy of your Shape3D and then
>         - Set the Appearance of the original with PolygonAttributes to
>fill the polygons (default)
>         - Set the Appearance of the copy with PolygonAttributes to draw
>the outlines.
>2)  Set up your SceneGraph such that you can use a SharedGroup and an
>alternate appearance for the second instance of the Shape3D.
>
>Important note:  You will likely run into issues with Z buffer tests when
>this occurs as the lines and the polygons will more than likely end up with
>the same Z value.  Therefore you should be able to adjust your Z test and
>order the rendering of your Shape3D objects as appropriate.
>
>The bottom line is that J3D could change the polygonMode member of
>PolygonAttributes to hold multiple modes, not just a single one.  Then
>everything would work with a single change of the PolygonAttributes.
>
>How about it Sun?
>
>At 11:06 AM 9/29/2000 -0400, you wrote:
>>Sorry.  My original goal is to put borders around each polygon in a Shape3D.
>
>
>
>Mark Ferneau                    240-462-6262 (cell)
>Director of Adv. Technology             801-437-4608 (efax)
>Xtivia Technologies, Inc.               732-469-5954 x629 (NJ office)
>[EMAIL PROTECTED]                      301-279-5703 (home office)
>http://www.xtivia.com/          [EMAIL PROTECTED] (wireless email)
>
>===========================================================================
>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".

===========================================================================
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