简体   繁体   中英

LWJGL3 and GLEW

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?

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.

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() }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM