0

I would like to create a 'simple' 2D library with OpenGL. I want to use OpenGL because I know I will learn lot of things that's why I don't want to use a higher level library (like SDL).

I know there is some library to make OpenGL a bit easier:

  • freeglut: I saw a recent release (freeglut 3.2.1 in 29 September 2019) but is it still used?
  • glfw: it seems more modern but seems too high level

I don't know if we can compare these libraries but what is the 'best' library (between glfw/freeglut) for learning?

There is also GLEW but I don't understand what is it.. Is it required? I just know it's unrelated with freeglut or glfw..

genpfault
  • 51,148
  • 11
  • 85
  • 139
Theo Cerutti
  • 779
  • 1
  • 10
  • 33
  • 1
    You mix different things. glfw and (free)glut are libraries for creating windows. OpenGL is not a library, it is a specification. See [OpenGL specification - Khronos OpenGL registry](https://www.khronos.org/registry/OpenGL/index_gl.php) . The OpenGL interface is provided by the OpenGL driver. For the OpenGL function binding it is recommended to use a loder like [Glad](https://glad.dav1d.de/) or [Glew](http://glew.sourceforge.net/). – Rabbid76 May 29 '20 at 19:50

1 Answers1

0

What is the 'best' library (between glfw/freeglut) for learning?

The best library is not using any if you really want to learn all the details.

You will need to learn how to load OpenGL functions on the fly based on the OpenGL version and extensions you want. You also will learn how to use your windowing system (e.g. Win32, X11, etc.) to create a window suitable for OpenGL rendering.

Typically most developers avoid some or all of that by using a library that loads OpenGL functions (e.g. GLEW) and/or creates the native window (e.g. SDL, glfw, glut; which typically work for several platforms), but you can do it by yourself if you really want.

A good option is to pick SDL and use it only for window initialization. That leaves you to load the OpenGL functions you use, which is fairly easy. Then, when you need input, you can use the SDL input subsystem too.

Acorn
  • 24,970
  • 5
  • 40
  • 69
  • 1
    I see you point. But opinion based question should not be answered at all. Yes I know, that is opinion based, too. – Rabbid76 May 29 '20 at 20:54
  • @Rabbid76 I agree in the majority of cases that is usually what should be done. Here I tried to explain to OP a bit of context (that is why I avoided referring to individual libraries initially). [OT: I wonder why SO does not remove/hide answers to closed questions and retract votes (at least downvotes) automatically, if they were not supposed to be answered...] – Acorn May 29 '20 at 21:00