Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is GLFW designed to use without LWJGL (in java)?

I know LWJGL is just a wrapper for OpenGL. It's a java library designed to use the lower level OpenGL functions in the java language.

As far as I understand now, GLFW is just a library which makes it possible to create better windows to display the graphics. So GLFW is just a library for creating windows in a better way than LWJGL did before.

Is it true that GLFW is not for creating graphics, but just for creating displays? And GLFW is not for using alone, you still should just use the LWJGL library to have access to the OpenGL functions to create graphics?

Can someone explain why I would use GLFW? And it seems there is a relation between LWJGL3 and GLFW, but what has it to do with each other?

like image 518
user2190492 Avatar asked Dec 14 '22 07:12

user2190492


1 Answers

Is it true that GLFW is not for creating graphics, but just for creating displays? And GLFW is not for using alone, you still should just use the LWJGL library to have access to the OpenGL functions to create graphics?

Yes.

Can someone explain why I would use GLFW? And it seems there is a relation between LWJGL3 and GLFW, but what has it to do with each other?

The main reason is that it's difficult* to get Java's Windowing API[-s] to behave interoperably with OpenGL. And even when you do get them to behave together, there's often substantial performance penalties for doing so.

GLFW, on the other hand, amounts to little more than a wrapper around the native Windowing API of your environment, whether it be Windows, MacOS, or Linux. Ostensibly this is what Java's AWT API is supposed to be, but again: AWT and Swing have performance problems, GLFW does not.

LWJGL is a wrapper for GLFW, but also a wrapper for the broader OpenGL API, including functions you'd normally have to manually load in C/C++ (typically through what's called GLEW, or the OpenGL Extension wrangler). They don't necessarily have a relationship to each other except for the fact that GLFW has to load some specific OpenGL functions to ensure that it can set up framebuffers correctly and take input from OpenGL (and also behave correctly when interfaced with various OpenGL extensions), but other than that, the two are essentially independent.

like image 81
Xirema Avatar answered Dec 16 '22 21:12

Xirema