Niklas Vest
Niklas Vest

Reputation: 902

Can I write an OpenGL application without binding it to a certain windowing library?

As I mentioned in a question before, I am trying to make a simple game engine in C++ with OpenGL.

I am currently using GLFW for drawing the OpenGL context and I chose it because I heard it's one of the faster ones out there. However, it doesn't support widgets and I really don't want to write them myself. So I decided to get into Qt a bit, because it would allow me to have a pane for the render context and different handy bars as well as all the fancy elements for editing a world map, setting OpenGL rules, etc.

I want to use GLFW on the exported version of that game, though. Is that possible without an abstraction layer of some kind?

Thanks in advance! :)

Upvotes: 0

Views: 100

Answers (1)

CoffeDeveloper
CoffeDeveloper

Reputation: 8317

Yes it is definitely possibile, infact I'm writing a 3D engine that is not coupled to any windowing library and can be used with Qt, SDL or whatever.

You of course have just to wrap regular GL calls into a higher level layer, this require you don't call "SwapBuffers" inside your GL code.

If by abstraction layer you mean "inversion of control" so, you don't want to override a "Render/Update" method that's exactly what I done. If by "abstraction layer" you mean you want to use GL directly than it is still possible.

Basically every windowing system have "some place" where you can make your GL calls (between MakeCurrent and SwapBuffers). Just read documentation of your windowing system.

Upvotes: 1

Related Questions