Re: Problems with creating a CLBuffer from existing DirectBuffer
Posted by notzed on Jun 23, 2011; 11:13pm
URL: https://forum.jogamp.org/Problems-with-creating-a-CLBuffer-from-existing-DirectBuffer-tp3099461p3102185.html
btw. the existing DirectFloatBuffer is allocated like this:
FloatBuffer buffer = ByteBuffer.allocateDirect(4*numElements).asFloatBuffer();
On a little-endian platform (i.e. x86) this wont work, it will treat the data as big-endian.
Something like this should:
FloatBuffer buffer = ByteBuffer.allocateDirect(4*numElements).order(ByteOrder.nativeOrder()).asFloatBuffer();
Although i think there is some jocl api to do this for you too.
Although I don't know if that's your only issue.