0

I'm trying to use OpenGL on Linux with the Mesa libraries but I'm confused as to what header/library combination I should actually be using.

The GL/gl.h file does not include any of the OpenGL 3.0+ functions, like glCreateProgram. These are however in the GL/glext.h file but only if GL_GLEXT_PROTOTYPES is defined. This would be linked against the GL library.

The GLES2/gl2.h includes all the definitions I need, and also has a different library GLESv2.

What is the correct combination of headers and libraries for a Linux desktop?

I can also add to this list should I be using GLUT, GLEW, or GLEX or EGL? All of these are all part of MESA and the samples seem to choose at random.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
edA-qa mort-ora-y
  • 30,295
  • 39
  • 137
  • 267

1 Answers1

1

IMO it's completely up to you on what you need, what you want to code yourself (esp. in case of GLUT) and what target platforms you've got:

  • If you'd like to target mobile platforms as well, GLES might be the better choice (as they usually don't support OpenGL, but OpenGL ES).

  • If you'd like to target Windows as well, you'll have to go OpenGL, as OpenGL ES is not supported (unless you use some additional layer, e.g. the Angle library).

Regarding the additional libraries mentioned - you don't need either for a minimal program, but they can save you time:

  • GLUT is a collection of useful snippets/functions commonly being "nice to have", e.g. a quick way to create a window or handle basic texture loading.

  • GLEW is a similar collection, making it easier to use extension not being in basic OpenGL (e.g. the mentioned glCreateProgram.

Mario
  • 35,726
  • 5
  • 62
  • 78
  • What about EGL vs GLX? I first tried EGL on the desktop, but none of the extended fucntions work (glClear works). So now I'm trying GLX. I will eventually target Android as well, and I already have EGL working there. – edA-qa mort-ora-y Aug 16 '12 at 08:34
  • They both provide an additional layer similar to GLUT, but EGL is for OpenGL ES and GLX is for OpenGL (on X Window System; WGL would be the Windows version). If you'd like to target Android, EGL is probably your best choice, however your desktop might not support everything out of the box and this can be driver dependant (don't have any experience regarding this part, sorry). – Mario Aug 16 '12 at 08:44
  • GLUT doesn't have any texture loading functions. And GLEW is an [OpenGL function loading library](http://www.opengl.org/wiki/OpenGL_Loading_Library). – Nicol Bolas Aug 16 '12 at 09:10