Login  Register

JOCL texture generation

Posted by fifty on Mar 11, 2014; 8:52pm
URL: https://forum.jogamp.org/JOCL-texture-generation-tp4031853.html

Hi,

I am looking for an example on how to setup a buffer/image to generate an RGBA texture
with JOCL. On my hardware Intel HD4600 CL-GL-interop does not seem to work.

I am currently trying to read-back the buffer/image and define the texture from it.

Buffer definition:
            CLBuffer<ByteBuffer> texBuffer = clContext.createByteBuffer(bufferWidth*bufferHeight*4, CLBuffer.Mem.WRITE_ONLY);

Texture definition after read-back of texBuffer:
           gl.glTexImage2D (GL3.GL_TEXTURE_2D, 0, GL3.GL_RGBA8, bufferWidth, bufferHeight, 0,
                      GL3.GL_RGBA, GL3.GL_UNSIGNED_BYTE, texBuffer.getBuffer());

kernel:
          __kernel void function ( __global const float* height,
                                            __global const float* pvec,
                                            __global unsigned char* store,
                                            unsigned len, unsigned w, unsigned h )

Now what is the correct order of RGBA components in "unsigned char* store"? Or is it better to use "uint*" with
"type=GL_UNSIGNED_INT" in JOGL?
Thanks a lot!