You are on page 1of 2

4/7/24, 4:19 PM opengl - Mesa GLES or GL + glext, which headers/libraries to use (GLUT, GLEW, GLX) - Stack Overflow

Mesa GLES or GL + glext, which headers/libraries to use


(GLUT, GLEW, GLX)
Asked 11 years, 7 months ago Modified 11 years, 7 months ago Viewed 2k times

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.
0
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.

opengl opengl-es mesa

Share Improve this question Follow edited Aug 16, 2012 at 13:06 asked Aug 16, 2012 at 7:55
Nicol Bolas edA-qa mort-ora-y
462k 63 799 1k 31.1k 40 142 273

1 Answer Sorted by: Highest score (default)

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:
1
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 .

Share Improve this answer Follow answered Aug 16, 2012 at 8:24
Mario
36.1k 5 64 82

https://stackoverflow.com/questions/11982866/mesa-gles-or-gl-glext-which-headers-libraries-to-use-glut-glew-glx?rq=3 1/2
4/7/24, 4:19 PM opengl - Mesa GLES or GL + glext, which headers/libraries to use (GLUT, GLEW, GLX) - Stack Overflow

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, 2012 at 8: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, 2012 at 8:44

GLUT doesn't have any texture loading functions. And GLEW is an OpenGL function loading library. – Nicol Bolas
Aug 16, 2012 at 9:10

https://stackoverflow.com/questions/11982866/mesa-gles-or-gl-glext-which-headers-libraries-to-use-glut-glew-glx?rq=3 2/2

You might also like