-1
\$\begingroup\$

Does OpenGL use the help of OpenCL to do the GPU calculations for shader and vertex, or OpenGL have another library to do GPU calculations.

\$\endgroup\$
2
  • \$\begingroup\$ OpenGL is not truly a "library" (despite the name). It's an API: a standardized way of communicating with a graphics card via a driver that complies with that standard. So you can't practically go "lower level" other than by switching to a more explicit API. It sounds like you may be interested in What's the lowest-level way of making graphics from scratch? Do I really need to use a graphics API? How to write my own 3D graphics library? etc. \$\endgroup\$
    – DMGregory
    Commented Feb 22, 2022 at 5:40
  • 2
    \$\begingroup\$ Judging by your previous question, it sounds like you might be a little early in your game development journey to be trying to create your own low-level graphics libraries from scratch. You'll be much more effective in this endeavour once you have some hands-on experience making games with existing libraries, and can deeply understand their use cases, pain points, and how they tick. Then you can put that understanding to work in designing your own that avoids first-timers' pitfalls or maybe even improves on what's available on the market now. \$\endgroup\$
    – DMGregory
    Commented Feb 22, 2022 at 5:49

3 Answers 3

3
\$\begingroup\$

OpenGL is implemented by the GPU vendor as part of their device driver.

Just to be specific about what OpenGL is and is not.

  • It is not a library. Older OpenGL specifications used to start with "OpenGL is a software interface to graphics hardware" and that's probably still the best description.

  • It is not open source. OpenGL actually pre-dates the open source movement and the "open" refers to it's status as a standard, nothing to do with source code.

  • There is not a single OpenGL, instead each GPU vendor has their own implementation.

  • It is not software. You can't just arbitrarily download or upgrade your OpenGL. While it is true that software implementations do exist, they are so slow as to be unusable for performance-critical real-time rendering.

Putting it all together the way things work is:

  • The GPU does the actual drawing.
  • OpenGL provides a way for your program to tell the GPU what to do.
  • OpenGL is implemented by the GPU vendor as part of their device driver.
  • OpenGL has a published specification.
  • Your program doesn't need to know details of the hardware in order to draw stuff.
  • If the GPU vendor correctly follows the specification, and if your program correctly follows the specification, everything works.

The part of all of the above that is relevant to your question is how does the GPU vendor implement OpenGL? and the answer is typically we don't know. So one vendor might implement it on top of another API, another vendor might go direct to the hardware using a DDK, a third vendor might do something else. The point is, we don't need to know; all we need to know is that OpenGL is implemented according to it's specification and then we can start writing code.

\$\endgroup\$
3
\$\begingroup\$

OpenGL was published in 1992 while OpenCL came out in 2009. The motivation for creating OpenCL was that some people started to abuse certain OpenGL features for solving general computing problems using the vector computing capabilities of GPUs even though those problems had nothing to do with graphics. OpenCL was invented to offer a more direct way to accomplish that.

It's not like one is built on top of the other. They are two alternative routes to access the computing capabilities of the GPU. One is designed for drawing pretty pictures, the other is designed for number crunching.

OpenGL and OpenCL are implemented by the graphics driver, which translates library calls into low-level instructions the GPU can understand. It is very well possible that some driver for some GPU might on some translation layer unify some functions of both APIs into one, so the GPU does not know if the instructions it receives from the driver originate from OpenGL or OpenCL calls. But that's really nothing you as a game developer should be concerned with, because you don't know what GPU with what driver the end-user is going to use.

\$\endgroup\$
2
\$\begingroup\$

Short answer - no.

You can add DirectX and Vulkan and others to your list - they are just different APIs that employ GPU resources in different ways.

\$\endgroup\$
2
  • \$\begingroup\$ Hey, congratulations on your 10k rep! \$\endgroup\$
    – Vaillancourt
    Commented Mar 24, 2022 at 15:14
  • \$\begingroup\$ @Vaillancourt thanks man! :-) I got 10k like months ago, but it just keeps on jumping up and down since I answer rarely \$\endgroup\$
    – Kromster
    Commented Mar 24, 2022 at 18:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.