简体   繁体   English

LWJGL3和GLEW

[英]LWJGL3 and GLEW

I am trying to port this tutorial to Kotlin/Java with LWJGL3 using the "modern" OpenGL versions. 我正在尝试使用“现代” OpenGL版本将教程移植到带有LWJGL3的Kotlin / Java。 I have followed this tutorial in c++, where I managed to create a coloured cube, that was rotated. 我已经按照c ++中的本教程进行了学习,在该教程中,我设法创建了一个旋转的彩色立方体。 Because I am not as familiar with c++, I made the decision to swap to Java/Kotlin. 因为我不太熟悉c ++,所以我决定换用Java / Kotlin。

I am unable to find the glewInit() function in LWJGL3 and all the other stuff around GLEW. 我无法在LWJGL3和GLEW周围的所有其他内容中找到glewInit()函数。 From what I have read, with glew I can access the modern OpenGL API. 从阅读的内容中,我可以轻松地访问现代OpenGL API。

I have looked up some LWJGL3 tutorials, but I was unable to find one with the modern OpenGL syntax. 我查阅了一些LWJGL3教程,但是找不到使用现代OpenGL语法的教程。

I have also read this question where, the answer seemed to me like LWJGL3 is basically GLEW for Java. 我也读过这个问题 ,在我看来,答案像LWJGL3基本上是Java的GLEW。

So is it true that I must access GLEW in order to write a "modern" OpenGL application? 我必须访问GLEW才能编写“现代” OpenGL应用程序吗? And if so, how with LWJL3? 如果是这样的话,LWJL3如何处理? Or is LWJGL3 the replacement for GLEW in Java? 还是LWJGL3可以替代Java中的GLEW?

GLEW is an OpenGL function loading library. GLEW是OpenGL函数加载库。 It's purpose is to allow you to access OpenGL, as provided by your implementation. 目的是允许您访问实现所提供的OpenGL。 This is important for programs written in C and C++, and GLEW is very much a C library. 这对于用C和C ++编写的程序很重要,而GLEW非常是一个C库。

LWJGL performs essentially the same function for Java. LWJGL对于Java基本上执行相同的功能。 It also does other things that GLEW doesn't (like managing the OpenGL window, etc). 它还执行GLEW不能执行的其他操作(例如管理OpenGL窗口等)。

So in Java, you don't need GLEW, and can't really use it even if you did. 因此,在Java中,您不需要GLEW,即使您确实不需要,也不能真正使用它。

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. 由于您使用的是Kotlin,因此我有一个小型包装器 ,可以改善lwjgl和glfw的使用体验,可能对您来说很有趣。

You can go up and running with a simple: 您可以使用以下简单的方法启动并运行:

glfw.init("3.3")
val window = GlfwWindow(1280, 720, "ImGui Lwjgl OpenGL3 example").apply { init() }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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