OpenGL

OpenGL is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.

WebGL is a cross-platform web standard for a low-level 3D graphics API based on OpenGL ES. Developers familiar with OpenGL ES 2.0 will recognize WebGL as a Shader-based API using GLSL, with constructs that are semantically similar to those of the underlying OpenGL ES API.

OpenGL, OpenGL ES, WebGL are parts of khronos group. There is also OpenGL official page.

libraries

OpenGL is low-level API, it is not game API. If you expect something more high-level, you can see

  • OpenSceneGraph - is an OpenGL-based high performance 3D graphics toolkit for visual simulation, games, virtual reality, scientific visualization, and modeling. It provides high-level rendering features not found in the OpenGL API. Written on C++ for Windows, Mac Os, Linux.
  • libGDX is a cross-platform Java game development framework that works on Windows, Linux, macOS, Android, your browser and iOS. It is based on lwjgl library.
  • freeglut is a open-source library that takes care of all the system-specific chores required for creating windows, initializing OpenGL contexts, and handling input events, to allow for trully portable OpenGL programs.
  • lwjgl is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan), audio (OpenAL) and parallel computing (OpenCL) applications. In other words, it is a wrapper for the C libraries OpenGL, OpenAL and OpenCL.

WebGL vs OpenGL

There are some significant differences in behavior of similar APIs between OpenGL ES and the OpenGL API on desktop systems.

1. WebGL supports only vertex and fragment shaders. OpenGL supports other types of shaders like geometry shaders, tessellation shaders, and compute shaders.

2. In WebGL, it is forced to learn use shaders and buffers from the start. In OpenGL, it is not like that.

3. OpenGL offers full support for non-power-of-two (NPOT) textures, OpenGL ES 2.0 and WebGL have only limited NPOT support.

legacy

There are lot examples with legacy code like below.

glBegin(GL_TRIANGLES);
    glVertex2f(0.200f, 0.100f);
    glVertex2f(0.300f, 0.400f);
    glVertex2f(0.100f, 0.400f);
glEnd();

If you are new to OpenGL, it is better to look into version 3.X or even 4.X instead of older ones. These versions use shaders instead of glVertex () functions for rendering.