Transform existing C++ openGL project from glut/freeglut to glfw
Asked Answered
A

1

6

I want to upgrade my scientific 3D application from Freeglut to GLFW, but I worried about hidden conflicts or loss of data, Actually my application works like a charm with Freeglut and I don't have any problem, but GLFW is recommended for modern OpenGL(3.0+) in all modern books and tutorials.

I look at GLFW API and It looks like Glut with glfw* prefix, but I'm not exactly sure. so I have three questions in mind:

  1. Is it worth to break my existing project for GLFW sake, or stick to freeglut?
  2. Am I going to loss any feature from glut?
  3. Is GLFW compatible with GTK+? (because my GUI is based on GTK)
Auspex answered 17/1, 2012 at 14:28 Comment(3)
I see no reason why you can't use opengl 3.0+ with freeglut, if your card supports itRegalia
Well, from a look into GLFW, I see more options then in freeglut. I guess thats the reason. not sure thoRegalia
Freeglut supports OpenGL3 just fine. Do something like glutInitContextVersion (3, 2); glutInitContextFlags (GLUT_FORWARD_COMPATIBLE); and you're ready to roll.Thriller
M
3

3- Is GLFW compatible with GTK+? (because my GUI is based on GTK)

Using GTK+ you should neither use Free-/GLUT nor GLFW. GTK+ has a OpenGL widget and does all the event management. Use that.

Mews answered 17/1, 2012 at 15:34 Comment(6)
@Ndv Just keep in mind that GLFW (like freeglut) is just a GUI library (like GTK+), that doesn't have anything to do with OpenGL.Dmitri
@Ndv So if you like to handle it your own, you won't get around managing the OpenGL context yourself using the platform's own API (wgl for win, glX for nix). Otherwise there is no argument for GLFW/GLUT but against GTK+, as both are just wrappers to the platform specific OpenGL and GUI managament, making them nothing more than GUI libraries with support for OpenGL context management. In this regard GLFW/GLUT and GTK+ are on the exact same abstraction level. Again: GLFW/GLUT doesn't belong or have anything to do with OpenGL, not more than GTK+ has.Dmitri
@Ndv: I can only agree with Christian Rau; GLUT and GLFW are not low level. You want to see low level? Then have a look at github.com/datenwolf/codesamples/tree/master/samples/OpenGL/…Mews
@Ndv Well, functions for context and window and input management does it make a GUI library. That easy. If you don't want to write a system based on GUI libraries (which is a good idea), then just seperate concerns. You have to do this the same for GTK+ like for GLUT/GLFW, since GLUT/GLFW doesn't have anything to do with OpenGL. Sorry for repeating but this is a crucial fact people often forget. So write your system in terms of OpenGL and not GLFW/GLUT/GTK+.Dmitri
@Ndv Well, prove the opposite. Then I might again have something to say. But until that there is really nothing more to say than GLUT/GLFW doesn't hav..., well I guess you finally got it.Dmitri
@Ndv Ok, sorry then. The answer to the third question is just no. Both are completely different libraries doing the same thing. The only way to make your code work with both is not depending on either library. Creating a context with GLFW for a GTK+ window will surely not work. GLFW (like GLUT) is as incompatible to GTK+ as Qt or MFC is. Nobody would ever try to mix them in one project and if your code/library is to be used with both, then don't depend on them. I don't see why this is a flame. I don't take sides. The opposite, I want to clarify that they're all equal and cannot be mixed.Dmitri

© 2022 - 2024 — McMap. All rights reserved.