From: <pet...@ba...> - 2001-11-27 07:12:49
|
Must be me then...just thought I'd try and eliminate that option before I spent too much time looking into it... Thanks. > -----Original Message----- > From: kbr...@al... [mailto:kbr...@al...] > Sent: Tuesday, November 27, 2001 6:35 AM > To: pet...@ba... > Cc: gl4...@li... > Subject: Re: [gl4java-usergroup] glDrawElements > > > *** WARNING *** > > This mail has originated outside your organization, > either from an external partner or the Global Internet. > Keep this in mind if you answer this message. > > > > > Java doesn't have any unsigned data types, so this method > dies a death > > when the signed data is read as unsigned, it becomes > massive and the > > native code tries to read beyond the end of the array. > > > > Or at least thats what I think is happening. I can't find > any examples > > in the demos that use glDrawElements: is this because it > doesn't work? > > http://java.sun.com/products/jfc/tsc/articles/jcanyon/ > > See the source code, specifically terrain.MultiResTile. > > Signed versus unsigned only really becomes an issue when > promoting to a larger type; for example, byte to int. If the high > bit is set and the type is signed (as all types are in Java) then > the value will be sign-extended. In Java this is most problematic > when dealing with byte and short types which automatically get > promoted to ints in intermediate expressions. I frequently > promote to int early, masking appropriately if necessary, and > deal with ints from then on. > > However, when dealing with OpenGL, one can pretty much ignore the > issue. You need to ensure that you are using the correct Java > data type to match the one expected by OpenGL (byte for > GL_UNSIGNED_BYTE, short for GL_UNSIGNED_SHORT, and int for > GL_UNSIGNED_INT). Even if the values in the array overflow into > the high bit (and therefore become negative in Java's view), > OpenGL will treat them properly. > ******************************************************************** This email and any attachments are confidential to the intended recipient and may also be privileged. If you are not the intended recipient please delete it from your system and notify the sender. You should not copy it or use it for any purpose nor disclose or distribute its contents to any other person. ******************************************************************** |