java - opengl中z坐标的值是多少

标签 java opengl lwjgl

我刚刚开始使用lwjgl 3学习现代opengl。我对opengl的坐标系感到困惑。

我知道,当您指定窗口的宽度和高度时,坐标将映射到该宽度和高度。例如,如果屏幕宽度为 600,则坐标 [1,0] 将映射到 [600,0]。

我想知道z坐标的距离值是多少?

最佳答案

z 坐标对应于深度。它的值通常是代表近平面和远平面之间片段距离的分数,如下所示:The camera and its near and far planes 。 Clipped 意味着片段不可见。

z/深度值主要用于深度测试,该过程将其他对象后面的对象(特别是它们必须被它们遮挡)剔除。这里有最好的描述(来自 learnopengl.com ):

OpenGL stores all its depth information in a z-buffer, also known as a depth buffer. GLFW automatically creates such a buffer for you (just like it has a color-buffer that stores the colors of the output image). The depth is stored within each fragment (as the fragment's z value) and whenever the fragment wants to output its color, OpenGL compares its depth values with the z-buffer and if the current fragment is behind the other fragment it is discarded, otherwise overwritten. This process is called depth testing and is done automatically by OpenGL.

我强烈建议查看 learnopengl.com即使您使用的是 LWJGL,因为您可以找到的大部分内容也适用于它。

关于java - opengl中z坐标的值是多少,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56582712/

相关文章:

java - 从 GNUMake 迁移到 Maven

c++ - 从 OpenMP 线程调用时,OpenGL 调用段错误

java - 如何在程序启动时验证 Java 版本?

java - GetText() 说明 - xpath 不返回值

java - 将对象存储在 arraylist 中并返回这些对象

java - Android 上使用 RenderScript 的中值滤波器

c++ - OpenGL - GL_LINE_STRIP 的行为类似于 GL_LINE_LOOP

opengl - 将 FP16 值存储在 RGBA8 纹理中

java - 使用 LWJGL 从 GLFW 主线程调度

java - LWJGL 使用 slick-util 从 jar 加载图像