Login  Register

Starting with JOCL

Posted by Giovanni Idili on Feb 12, 2011; 5:26pm
URL: https://forum.jogamp.org/Starting-with-JOCL-tp2481173.html

HI All,

I am getting started with JOCL, trying to run the HolleJOCL demo.

Here's my problem:

When creating buffers I get an error on buffer C, the only only created as WRITE_ONLY

CLBuffer<FloatBuffer> clBufferA = context.createFloatBuffer(globalWorkSize, READ_ONLY);
CLBuffer<FloatBuffer> clBufferB = context.createFloatBuffer(globalWorkSize, READ_ONLY);
CLBuffer<FloatBuffer> clBufferC = context.createFloatBuffer(globalWorkSize, WRITE_ONLY);

Error message:

Exception in thread "main" java.lang.OutOfMemoryError: Direct buffer memory
        at java.nio.Bits.reserveMemory(Bits.java:633)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:98)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
        at com.jogamp.common.nio.Buffers.newDirectByteBuffer(Buffers.java:67)
        at com.jogamp.common.nio.Buffers.newDirectFloatBuffer(Buffers.java:109)
        at com.jogamp.opencl.CLContext.createFloatBuffer(CLContext.java:316)
        at HelloJOCL.main(HelloJOCL.java:35)

Any idea what this is and how can I get past it?

Thanks!