I know there are a bunch of well-known libraries for this (e.g. OpenGL); but they are just normal libraries after all and there's no fundamental difference between them and the programs that me and you write.
Oh, they are quite different from "normal libraries".
Take OpenGL for example. Part of that is a DLL or SO that you load. But part of that is something called a "driver" or "graphics driver". That is not a "normal library" at all; it is fundamentally a part of the operating system. It's basically a part of the OS that someone other than the OS maker wrote.
The system defines the interface for a driver, and hardware makers provide a driver library that fits into that interface. But that's not something that a normal user is able to provide, nor do most games run by installing their own graphics driver.
The purpose of the driver is to provide a uniform interface to graphics hardware for the OS and clients of the OS. Different hardware is different, but each driver for an OS exports the same interface (more or less), which allows client code to not have to know the details of the hardware.
This also prevents client code from breaking the system. If you crash a GPU (which, since it's a processor, is a thing you can do nowadays), someone has to deal with that. The OS handles CPU faults, and the graphics driver/OS nowadays handles GPU faults too. But in order to do that, it has to stand between you and the hardware.
On most operating systems, directly and arbitrarily accessing video memory is not allowed. Not for any program which is not itself a graphics driver. Many low-level APIs like OpenGL allow you to map certain memory allocations, so that you can access them. But that's very different from just giving someone a GPU memory pointer; after all, there's no guarantee that the mapped pointer actually points to GPU memory.
Oh, and they don't let you map textures or framebuffers, since they want to keep the details of hardware texture formats implementation-defined.
/dev/fb0
. Modern Linux systems with open source drivers give you access to the video memory via libdrm & co. – Casabonne