jogl - 如何将GLU与GL3一起使用(jogl - how to use GLU with GL3)

我不确定GLU类如何使用可编程管道与GL3及更高版本协同工作。 我已经看到了几个例子(jogl + GL3示例似乎很少),其代码如下:

GL3 gl = glAutoDrawable.getGL().getGL3(); glu.gluPerspective(80.0f, 1920.0f / 1080.0f, 0.1f, 100f);

glu.gluPerspective(...)不返回任何内容,那么如何访问计算出的projectionMatrix以将其传递到着色器? 同样适用于gluLookAt(...)。 如果在着色器中将这些作为默认属性提供,我将如何使用拾取算法,我需要根据相机位置创建向量?

I am unsure as to how the GLU class works with GL3 and higher using a programmable pipeline. I have seen a couple of examples (jogl+GL3 examples seem scarce) that have code like the following:

GL3 gl = glAutoDrawable.getGL().getGL3(); glu.gluPerspective(80.0f, 1920.0f / 1080.0f, 0.1f, 100f);

glu.gluPerspective(...) doesn't return anything, so how do I access the calculated projectionMatrix to pass it into the shader? Similarly for gluLookAt(...). If these are made available in the shader as a default attribute what do I use for things like picking algorithms, where I need to create a vector based on the camera position?

最满意答案

如果你在谈论核心配置文件OpenGL ......你不会。 您必须停止使用GLU并开始使用实际的矢量/矩阵库。

If you're talking about core-profile OpenGL... you don't. You have to stop using GLU and start using an actual vector/matrix library.

更多推荐