Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blitting with OpenCL

I am making an OpenCL raycaster, and I'm looking to blit pixels to the screen with the less overhead possible (Every tick counts), as low than calling glClear() every tick, I thought of creating a framebuffer to draw to and passing it to OpenCL, and then blitting with glBlitFramebuffer() but I think that automatically drawing to screen is way better, so there, is there a way to draw pixels with openCL ? Hacky stuff are OK

The best thing I can do now is check out how glClear does it ...

like image 605
Whiteclaws Avatar asked Mar 28 '14 21:03

Whiteclaws


1 Answers

The usual approach is to use OpenCL to draw to a shared OpenGL/OpenCL texture object (created with the clCreateFromGLTexture() function) and then draw it to the screen with OpenGL by rendering a full-screen quad with that texture.

Edit: I've written a small example which uses OpenCL to calculate a mandelbrot fractal and then renders it directly from the GPU to the screen with OpenGL. The code is here: mandelbrot.cpp.

like image 99
Kyle Lutz Avatar answered Sep 16 '22 12:09

Kyle Lutz