What features make OpenCL unique for choosing OpenGL using GLSL for calculations? Despite graphically related terminology and practical data types, is there any real obstacle to OpenGL?
Yes: this is a graphical API. Therefore, everything that you do in this should be formulated on these conditions. You should pack your data in the form of "rendering". You must figure out how to handle your data in terms of attributes, uniform buffers, and textures.
With OpenGL 4.3 and OpenGL ES 3.1 calculate shaders , things get a little more confusing. The computational shader is able to access memory through SSBOs / Image Load / Store in the same way for OpenCL operations (although OpenCL offers actual pointers, but GLSL does not). Their interaction with OpenGL is also much faster than OpenCL / GL interop.
Nevertheless, computational shaders do not change one fact: OpenCL computation operations work with completely different accuracy than using OpenGL shaders. GLSL floating point precision requirements are not very stringent, and OpenGL ES is even less stringent. Therefore, if the accuracy of floating point calculations is important for your calculations, OpenGL will not be the most efficient way to calculate what you need to calculate.
In addition, OpenGL shader processors require 4.x compatible hardware, while OpenCL can run on much lower hardware.
Also, if you are doing calculations co-opting with the rendering pipeline, OpenGL drivers still assume that you are rendering. Therefore, he will make optimization decisions based on this assumption. It optimizes the allocation of shader resources, provided that you draw an image.
For example, if you pass a floating-point framebuffer, the driver may simply decide to provide you with the R11_G11_B10 framebuffer, because it detects that you are not doing anything with alpha, and your algorithm may tolerate lower precision. If you use loading / saving images instead of a framebuffer, you are unlikely to get this effect.
OpenCL is not a graphical API; This is a computational API.
In addition, OpenCL gives you access to more materials. This gives you access to memory levels that are implicitly related to GL. Some memory can be shared between threads, but individual instances of shaders in GL cannot directly affect each other (outside the Image Load / Store, but OpenCL runs on hardware that does not have access to this).
OpenGL hides what hardware does behind abstraction. OpenCL provides you with almost what is happening.
You can use OpenGL to do arbitrary calculations. But you do not want; there is no completely viable alternative yet. Compute in OpenGL to serve the graphics pipeline.
The only reason for choosing OpenGL for any calculation operation without rendering is the support of equipment that cannot run OpenCL. Currently, this includes many mobile devices.