cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

write in a image2d_t created with GL_RGBA8 ?

Hi,

For OpenCL/OpenGL interop I create a texture with the following code :

glGenTextures(1, (GLuint*)&_displayTexture1Id);
glBindTexture(GL_TEXTURE_2D, (GLuint)_displayTexture1Id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, _width, _height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);

But how can I write a RGBA8 with OpenCL (on the kernel level). I only have methods like write_imagei that request a "int4" (4x32) and there is no "4x8" related method ?

Thanks

0 Likes
1 Solution
nou
Exemplar

GL_RGBA8 correspond to CL_UNORM_INT8 image format. (refer to 9.7.3.1 of OpenCL specification) so you need use write_imagef() method and write floats in range 0.0-1.0. if you want use write_imagei() you need create GL_RGBA8I format.

View solution in original post

0 Likes
1 Reply
nou
Exemplar

GL_RGBA8 correspond to CL_UNORM_INT8 image format. (refer to 9.7.3.1 of OpenCL specification) so you need use write_imagef() method and write floats in range 0.0-1.0. if you want use write_imagei() you need create GL_RGBA8I format.

0 Likes