The OpenGl code is the same on each platform but the setup and handling of the windows depends on the platform. Below is a overview on how it is done on each platform but first some multi-platform library's to make it possible to avoid writing any such code at all.
GLFW - http://www.glfw.org
SDL - https://www.libsdl.org
SFML - http://www.sfml-dev.org
OpenGL Utility Toolkit (GLUT) - https://www.opengl.org/resources/libraries/glut
Common toolkit used in older samples and not active any more. No reason to use it in anything new. Look at GLFW instead.
To create the OpenGl context in a window one use the WGL API.
CGL and NSOpenGL.
On linux the interface to setup OpenGL is called GLX.