Bug 179 - Add documentation on importance of byte ordering
Summary: Add documentation on importance of byte ordering
Status: VERIFIED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: All all
: P3 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2005-10-28 03:04 CEST by Sven Gothel
Modified: 2015-09-27 03:14 CEST (History)
0 users

See Also:
Type: FEATURE
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-24 07:48:05 CET


---- Reported by pepijnve 2005-10-28 03:04:09 ----

Some documentation should be added to the package documentation explaining the
importance of byte ordering when using Buffer objects.
A Buffer orders the bytes of multibyte values based on its ByteOrder. Jogl does
not look at the byte order of Buffer parameters and simply passes them on to the
underlying OpenGL implementation. If users are not using native byte ordering,
this could cause issues when developing cross-platform, since the default
ordering is big endian which may or may not corresponds with the underlying
platforms byte ordering. This issue does not occur when using primitive arrays,
since JNI takes care of properly converting primitive values.



---- Additional Comments From pepijnve 2005-10-28 03:08:25 ----

This issue does not occur when using primitive arrays, since JNI takes care of
properly converting primitive values.

This sentence is not accurate, so it should be disregarded.



---- Additional Comments From kbr 2006-01-22 08:51:46 ----

Added text to the spec overview regarding setting byte order of newly-allocated
ByteBuffers to native order.

<h4>Byte ordering of Buffers</h4>
 When allocating a New I/O Buffer (in particular, a direct ByteBuffer)
to be passed to the APIs in these packages, it is essential to set the
<em>byte ordering</em> of the newly-allocated ByteBuffer to the
<em>native</em> byte ordering of the platform:
e.g. <code>ByteBuffer.allocateDirect(...).order(ByteOrder.nativeOrder());</code>.
The byte order of the ByteBuffer indicates how multi-byte values such
as int and float are stored in the Buffer either using methods like
putInt and putFloat or views such as IntBuffer or FloatBuffer. The
Java bindings perform no conversion or byte swapping on the outgoing
data to OpenGL, and the native OpenGL implementation expects data in
the host CPU's byte order, so it is essential to always match the byte
order of the underlying platform when filling Buffers with data. <br>




--- Bug imported by sgothel@jausoft.com 2010-03-24 07:48 EDT  ---

This bug was previously known as _bug_ 179 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=179