0

I am trying to port this tutorial to Kotlin/Java with LWJGL3 using the "modern" OpenGL versions. I have followed this tutorial in c++, where I managed to create a coloured cube, that was rotated. Because I am not as familiar with c++, I made the decision to swap to Java/Kotlin.

I am unable to find the glewInit() function in LWJGL3 and all the other stuff around GLEW. From what I have read, with glew I can access the modern OpenGL API.

I have looked up some LWJGL3 tutorials, but I was unable to find one with the modern OpenGL syntax.

I have also read this question where, the answer seemed to me like LWJGL3 is basically GLEW for Java.

So is it true that I must access GLEW in order to write a "modern" OpenGL application? And if so, how with LWJL3? Or is LWJGL3 the replacement for GLEW in Java?

Samuel Kodytek
  • 1,004
  • 2
  • 11
  • 23

2 Answers2

4

GLEW is an OpenGL function loading library. It's purpose is to allow you to access OpenGL, as provided by your implementation. This is important for programs written in C and C++, and GLEW is very much a C library.

LWJGL performs essentially the same function for Java. It also does other things that GLEW doesn't (like managing the OpenGL window, etc).

So in Java, you don't need GLEW, and can't really use it even if you did.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
1

You should follow the hello world on the website.

Since you are using Kotlin, I have a small wrapper that improves the experience with lwjgl and glfw and might be interesting for you.

You can go up and running with a simple:

glfw.init("3.3")
val window = GlfwWindow(1280, 720, "ImGui Lwjgl OpenGL3 example").apply { init() }
elect
  • 6,765
  • 10
  • 53
  • 119
  • The wrapper is very helpful! Thank you, I will look into it deeper! I did started following it, I just can't seem to find a very friendly tutorial, for a "beginner" to a modern OpenGL with LWJGL3, I know the gitbook exists, but as I said, it seems very complicated. I have read on some forum, that the binding should be still same as in lwjgl2 so I might as well just follow a LWJGL2 tutorial, and fight somehow with the GLFW, which is frankly very well documented! – Samuel Kodytek Jul 03 '18 at 12:12