OpenGL is an interface to perform graphical commands. Now, if the library is multi-platform how does it interact with the GPU is it by making system calls and thus making it multi-platform or does it use drivers to perform its operations?
In OpenGL, an image is sent to the GPU through Texture Objects. This Texture Object is placed in a Texture-Unit. The fragment shader references this texture-unit through a Sampler. The fragment shader then uses the U-V coordinates along with the sampler data to properly map an image to the game character.
Sure. Many software only implementations of OpenGL exist. Check out the Mesa project at http://www.mesa3d.org/ for one of the most popular. There are parts of the shading language not fully supported, and it tends to lag the standard a bit in general, but that is the case of all software API emulators.
The graphics driver keeps track of the GPUs state and all the resources application programs that make use of the GPU. Also it is responsible for conversion or any other processing the data sent by applications (convert textures into the pixelformat supported by the GPU, compile shaders in the machine code of the GPU).
Is OpenGL Open Source? No, OpenGL doesn't have any source code. GL is a specification which can be found on this website. It describes the interface the programmer uses and expected behavior.
OpenGL is typically implemented as part of the graphics drivers. Each implementation will use implementation-specific interfaces to talk to some kernel-space component and the real HW.
One can see a bit more how these things might be done by looking at the MESA based open-source GL implementation on Linux. They actually use the DRM (direct rendering manager) API of the Linux kernel to talk to the HW. MESA's current implementation is organised such that for each GPU, there is a drm kernel driver and a user-space DRI client. Mesa now uses the gallium API as an abstraction layer to keep the GPU-specifc code small and make it more portable. The OpenGL API is implemented on top of that as a "state tracker:, and is independent of the GPU drivers. (There even has been a D3D10/11 state tracker, but it was more like a test and was later removed because it became unmaintained.)
The fact that OpenGL is defined as a plaform-independent API does not mean that the OpenGL library will be platform-independent at all. This is the same situation as with the C library API is part of the language standard, but the implementation is very platform-specific.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With