【发布时间】:2018-12-29 15:45:20
【问题描述】:
我创建了一个 Matrix4f,它是我的着色器的正交透视图。要存储着色器的上传矩阵,需要将其存储在 FloatBuffer 中。当我想将矩阵放入 FloatBuffer 时,我的数学库 JOML 出现错误。 (我用的是 LWJGL3) 以下是错误:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.joml.MemUtil$MemUtilUnsafe
(file:/C:/Dev/Java/Learn%20OpenGL/lib/joml-1.9.6.jar) to field
java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of
org.joml.MemUtil$MemUtilUnsafe
WARNING: Use --illegal-access=warn to enable warnings of further illegal
reflective access operations
WARNING: All illegal access operations will be denied in a future release
这是我的代码:
matrix4f = new Matrix4f().ortho(-2.0f, 2.0f, -1.5f, 1.5f, 1.0f, 1.0f);
FloatBuffer matrixBuffer = BufferUtils.createFloatBuffer(16);
matrix4f.get(matrixBuffer);
GL20.glUniformMatrix4fv(Shader.getLocation(shader, "transformationMatrix"), false, matrixBuffer);
【问题讨论】:
-
最好知道你的 Java 版本。我假设它是 10 或 11(但不是 9,对吧?)
-
至少使用 JOML 1.9.10。使用 JDK 9、10、11、12-ea 和 13-ea 时不会出现任何此类错误/警告。
-
欢迎支持 btw ...