In LWJGL 2 I could to use a older profile of OpenGL do that:
PixelFormat pixelFormat = new PixelFormat();
ContextAttribs contextAtrributes = new ContextAttribs(3, 2) //<--
.withProfileCore(true)
.withForwardCompatible(true);
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.setTitle(WINDOW_TITLE);
Display.create(pixelFormat, contextAtrributes);
In LWJGL 3 there is no Display class anymore, how can I do it there?
Use glfwWindowHint
for the ContextAttribs
:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
Then
glfwCreateWindow(width, height, title, 0, 0)
glfwWindowHint
can also change the options found in PixelFormat
, and the defaults are different so you may want to.
You will also need to call glfwInit()
before all of this.
More complete guide can be found here: http://www.lwjgl.org/guide