0% found this document useful (0 votes)
32 views

C++ - Where Is Opengl Located (Gpu Software or Os) - Stack Overflow

OpenGL is an API that allows programs to interface with the GPU driver to render 3D graphics. The GPU hardware executes graphics code, while the driver handles communication between programs and the GPU via the OpenGL API. For most operating systems, the drivers are closed source, but open source community drivers also exist, like Nouveau.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

C++ - Where Is Opengl Located (Gpu Software or Os) - Stack Overflow

OpenGL is an API that allows programs to interface with the GPU driver to render 3D graphics. The GPU hardware executes graphics code, while the driver handles communication between programs and the GPU via the OpenGL API. For most operating systems, the drivers are closed source, but open source community drivers also exist, like Nouveau.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Where is opengl located(gpu software or os)?

[duplicate]
Asked 6 years, 2 months ago Modified 6 years, 2 months ago Viewed 1k times

This question already has answers here:


How does OpenGL work at the lowest level? [closed] (4 answers)
1
Closed 6 years ago.

I am writing an x86 os and a question popped into my mind: If I would want to create a simple opengl
game in my os, would I be able to do that without reinventing opengl? SO what I am asking is, is opengl
included in e.g. the nvideo drivers, or is it located in the gpu firmware? If it would be in the gpu, i could
simple port/create a opengl wrapper right?

Can someone elaborate on this?

Thanks

c++ opengl x86 operating-system wrapper

Share Improve this question Follow asked Jan 15, 2018 at 17:40
user2083443

GPU, software or OS? Yes to all. The hardware accelerates OpenGL operations, which can be performed by
hardware or software. The OS is responsible for managing the screen to OpenGL relationship (context); loading
and managing the OpenGL driver(s). Suggest you read some history of graphics programming and development.
– Richard Critten Jan 15, 2018 at 17:43

OpenGL is a standard like C++. It specifies which functionalities must exist and how they work in order to be called
OpenGL compatible. If you want to implement OpenGL you would need to look through the standard and just do it.
Ideally though you would port existing drivers that do most implementations by telling the graphics card to do it.
– nwp Jan 15, 2018 at 17:43

Well, where would i find nvidea or amd drivers? Arent they closed source? And, thus, opengl is just a way of letting
a gpu draw a 3d world(just like directx is)or is opengl a program loaded to the gpu and that then loads a 3d world?
– user2083443 Jan 15, 2018 at 17:51

1 With a lot of effort you might be able to port one of the open source drivers (such as Nouveau). With a lot more
effort you could probably get a closed source driver to work too. – user253751 Jan 15, 2018 at 21:24

2 Answers Sorted by: Highest score (default)

OpenGL is the API of the GPU driver. Taking nVidia as an example, they release closed source drivers
for supported operating systems. There are also open source drivers (the nouveou project) that try to
3 reverse engineer the nVidia graphics cards and implement an open source driver for them. The same is
also true for other vendors to some extent.

So considering your scenario, you should either implement an ABI compatibility layer in your OS with a
widely supported OS so that you could run the closed-source drivers, or port the open-source
community drivers to your OS.
Share Improve this answer Follow answered Jan 15, 2018 at 18:04
Yakov Galka
71.5k 16 143 220

The GPU hardware executes specific code. Some of this code is programmable, which means that you
write special code that runs inside the GPU card.
2
The instructions to pass this special code (shaders in OpenGL parlance) and the data they handle are
the graphics API (OpenGL, DirectX). There are also more instructions for the GPU, they are also
handled by the API.

This API lives in the graphics card driver.

First, an app asks the OS to provide the function pointers to the API commands. These pointers are
retrieved from the driver. Then the app use these pointers to comunicate with the GPU (via driver).
Two details: Retriving pointers is not needed in MAC, they provide them as any C++ instruction. This is
also true in Windows, but just for OpenGL 1.1

The drivers for Windows and Mac are propietary software.


In Linux nVidia, AMD and Intel provide their drivers (but mostly as closed source). Also in Linux, there
are open source drivers, which some developers wrote on their own.

Finally, There is a software inplementation of the OpenGL API done by Mesa. Mesa also is one of those
that writes open source drivers for Linux.

Share Improve this answer Follow answered Jan 15, 2018 at 18:06
Ripi2
7,155 1 17 35

You might also like