Sign in to follow this  
Defeatist

Drawing with OpenCL

Recommended Posts

Hey!

I plan on rewriting my (small) voxel renderer in OpenCL. I have seen several examples where OpenCL and graphics are combined using OpenGL or D3D "interop". I plan on doing everything graphics related in OpenCL and to make things easier I want to use OpenCL only. What is the correct method to draw things to a window? Do I send the results from a single frame back to the host application and then blit it to the screen? Im not looking for window system specific code but examples could still be helpful.

Share this post


Link to post
Share on other sites
[quote name='Erik Rufelt' timestamp='1303046734' post='4799465']
You share a texture with OpenGL or Direct3D, and present that to the window as usual. There should be examples in both the NVidia and ATI SDKs.
[/quote]

Do you mean that is the method that will probably faster and more compatible than anything I'd write myself, or are they simply doing something I can't easily replicate? All I need the code to copy the stuff to the screen when all rendering is completed and I don't like relying on a larger library just for that.

Share this post


Link to post
Share on other sites
[quote name='Defeatist' timestamp='1303058932' post='4799508']
[quote name='Erik Rufelt' timestamp='1303046734' post='4799465']
You share a texture with OpenGL or Direct3D, and present that to the window as usual. There should be examples in both the NVidia and ATI SDKs.
[/quote]

Do you mean that is the method that will probably faster and more compatible than anything I'd write myself, or are they simply doing something I can't easily replicate? All I need the code to copy the stuff to the screen when all rendering is completed and I don't like relying on a larger library just for that.
[/quote]

Since the OpenCL data normally is stored on the GPU the most performant way to get it to render would be by having OpenGL or D3D render that data directly, copying the data over to RAM will always be slower unless you are rendering to a file, network device or something else that the gpu can't access directly. clEnqueReadBuffer can be used to read the data back to the host application.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this