Jump to content
  • Advertisement
Sign in to follow this  
Defeatist

Drawing with OpenCL

This topic is 2593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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.

Share this post


Link to post
Share on other sites

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.


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='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.


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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!