私は最初にLWJGLを学び、LWJGL3 siteの例として挙げた単純なコードブロックを調べています。私はOpenGLまたはGLFWを使用することはありません。LWJGL初心者 - stackPush()、mallocInt(1)などのGLFWメソッドとは何ですか?
私はこの小さなコードを理解できません。私がそれを削除すると、メインコードはまだ動作します。この全体は、作成時にウィンドウを中央に置くだけですか?
mallocInt (1)
はどういう意味ですか? stackPush()
のこの全体的なアイデアと奇妙なメソッド呼び出しは混乱します。私はSWTとawtを使用して、それのようなものは見たことがありません。
// Get the thread stack and push a new frame
try (MemoryStack stack = stackPush()) {
IntBuffer pWidth = stack.mallocInt(1); // int*
IntBuffer pHeight = stack.mallocInt(1); // int*
// Get the window size passed to glfwCreateWindow
glfwGetWindowSize(window, pWidth, pHeight);
// Get the resolution of the primary monitor
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
// Center the window
glfwSetWindowPos(window,
(vidmode.width() - pWidth.get(0))/2,
(vidmode.height() - pHeight.get(0))/2);
}
// the stack frame is popped automatically
すべてのヘルプははるかに高く評価されます。