I've recently started learning OpenGL (> 3.3) & I've noticed a lot of examples & tutorials use both freeglut & glew, but don't really explain the difference at all. The best description I've found, after googling & reading ad nauseum, has been this OpenGL Related toolkits and APIs but found it lacking. I've even read the tag info on SO.
As someone really new to OpenGL I'm still trying to get a grasp of the different concepts. I've gotten to the stage of creating a basic program that uses glew, create context (on windows, VS2010), & draw really basic shapes, all without the need for explicitly including freeglut. So I don't understand why I would need it.
So my question then is, what's the difference between:
-freeglut
-glew
-(& glfw)
What can one do that the other can't?
Glad is typically used by selecting the necessary extensions in the web interface, downloading the generated source and header files and copying them into your project. GLEW is a library that needs to be installed and is usually added as an dependency in, e.g., CMake.
To answer the question "Which one should I use?" -- in any case you want to use GLEW (or an alternative, but GLEW works fine), but you most likely want to use both GLEW and GLFW since it makes your life easier.
GLEW isn't 'required', as you put it. You could use glcorearb. h header, or anything like that. However, if you link with some function - it must exist on target platform, or your program wouldn't launch.
GLEW and GLFW are kind of cross-platform so you don't have to write different versions of the same application on different platforms. As practice shows, GLEW/GLAD + GLFW is a common use for modern computer graphics based on OpenGL. You could, however, choose other libraries for a reason, based on what you need.
The OpenGL Extension Wrangler (GLEW) is used to access the modern OpenGL API functions(version 3.2 up to latest version).If we use an ancient version of OpenGL then we can access the OpenGL functions simply including as #include <GL/gl.h>
.But in modern OpenGL, the API functions are determined at run time, not compile time. GLEW will handle the run time loading of the OpenGL API.About GLEW see here
GLFW or freeglut will allow us to create a window, and receive mouse and keyboard input in a cross-platform way. OpenGL does not handle window creation or input, so we have to use these library for handling window, keyboard, mouse, joysticks, input and other purpose.
GLFW and freeglut are alternative for us according to our need we can choose any one but GLEW is different from them which is used for run time loading of the OpenGL API.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With