Re: JOCL texture generation
Posted by
fifty on
Mar 12, 2014; 4:48pm
URL: https://forum.jogamp.org/JOCL-texture-generation-tp4031853p4031870.html
Thanks! I can upload my small test program for copying an CL image to an GL RGBA texture.
I could make the host copy work now. The problem was not with the copy but with preparing the VBO
for rendering the textured quad!!!
private ByteBuffer clone (float[] data)
{
int len = data.length;
ByteBuffer direct = ByteBuffer.allocateDirect(len*4);
direct.order(ByteOrder.nativeOrder()); // very important!
for (int i=0; i<len; ++i) {
direct.putFloat(data[i]);
}
direct.rewind();
return direct;
}
I left out the direct.order call on the ByteBuffer.
I am not sure, if there is a util function for this task!
Still, I could not make the GL texture object sharing work.
clContext2.createFromGLTexture2d gives me an exception:
Exception in thread "AWT-EventQueue-0" com.jogamp.opencl.CLException: unknown ca
use: code 201779856 [error: unknown]
at com.jogamp.opencl.CLException.checkForError(CLException.java:67)
at com.jogamp.opencl.gl.CLGLTexture2d.createFromGLTexture2d(CLGLTexture2
d.java:66)
at com.jogamp.opencl.gl.CLGLContext.createFromGLTexture2d(CLGLContext.ja
va:284)
at com.jogamp.opencl.gl.CLGLContext.createFromGLTexture2d(CLGLContext.ja
va:272)
at DemoViewer.initCL(DemoViewer.java:334)
at DemoViewer.init(DemoViewer.java:193)