Watch out... some of these are not clean bits.

In other words flags & COLOR_3 will != 0 even if flags == COLOR_4.

I always check like this:

((flags & XXXX) == XXXX)

I only know I once had several hours of pain wondering why my code was not
working since I had assumed it was one bit per flag type and was doing
((flags & XXXX) != 0).

Dave Yazel

-----Original Message-----
From: David Rush [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 10, 2002 1:05 PM
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] How do I...


Ta very much.

David

>
> From: Daniel Selman <[EMAIL PROTECTED]>
> Date: Wed 10/Apr/2002 19:04 CEST
> To: [EMAIL PROTECTED]
> Subject: Re: [JAVA3D] How do I...
>
> David,
>
> The universally useful & and | operators.
>
> in vertexFormat = foo.getVertexFormat();
>
> if( (vertexFormat & GeometryArray.BY_REFERENCE) ==
> GeometryArray.BY_REFERENCE)
> {
>         // yep, the bit is set...
> }
>
> Sincerely,
>
> Daniel Selman
>
> Author - "Java 3D Programming"
> http://www.manning.com/selman
>
> -----Original Message-----
> From: Discussion list for Java 3D API
> [mailto:[EMAIL PROTECTED]]On Behalf Of David Rush
> Sent: Wednesday, April 10, 2002 10:03 AM
> To: [EMAIL PROTECTED]
> Subject: How do I...
>
>
> ..query a GeometryArrayobject to find out if it is BY_REFERENCE or not?
> I thought getVertexFormat() should work but the vertex format is input as
a
> bitmask i.e.
>
> GeometryArray.COORDINATES | GeometryArray.NORMALS |
> GeometryArray.BY_REFERENCE
>
> How can I get just the BY_REFERENCE bit?
>
> David
>
>
===========================================================================
> 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".
>
>

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