cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

kbrafford
Adept II

Shared context texture example

Is there a concise demo available showing how to do some calculations that generate a 2D array of pixel values with OpenCL, then shows how to use that image as a texture in OpenGL (say, mapping it onto a spinning cube or something like that)?

0 Likes
3 Replies
nou
Exemplar

look into SimpleGL example from APP SDK. it use buffer for VBO but it is almost the same as texture. just change buffer function into image equvivalents.

0 Likes

>just change buffer function into image equvivalents.

 

Heh....that's what I don't know how to do 🙂

0 Likes

you replace clCreateFromGLBuffer() with clCreateFromTexture2D(context, flags, GL_TEXTURE_2D, 0, gl_texture, &err);

only diference is specify texture_target and mipmap level. you just pass GL_TEXTURE_2D and mipmap 0.

also in kernel you treat it as image2d_t

0 Likes