6
\$\begingroup\$

Been looking for a way to implement some OpenCL stuff in my libGDX project. It's possible via LWJGL which libGDX is based on, but it's only for the Desktop environment.

I would like to have it cross platform as libGDX was meant to be used; how can I do that?

\$\endgroup\$
1
\$\begingroup\$

OpenCL is not supported on all platforms, this means it's a platform dependent feature no matter what library/engine/whatever you throw at it.

The only way to use this in a platform independent way would be to query lwjgl for whether you are in an environment that supports OpenCL and use a CPU fallback solution in the case that it's not supported.

That's it for OpenCL basically. You could otherwise use Compute Shaders: https://stackoverflow.com/a/15874988

With them you are not dependent on OpenCL support but on the OpenGL version which is easier to fulfill on mobile. There are some differences between OpenGL ES and Desktop OpenGL though, i don't know how well lwjgl handles this. Compute shaders are generally supported though: https://github.com/LWJGL/lwjgl3-wiki/wiki/2.6.2.-Ray-tracing-with-OpenGL-Compute-Shaders-%28Part-II%29

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.