- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 OpenGL 新手,仍在尝试基本形状。我有时会发现许多函数,例如 glEnd
等,OpenGL 3+ 文档中未提及这些函数。它们被其他功能取代了吗?或者我必须手动编写它们?是否有使用 OpenGL 3+ 的在线教程?
至于“gluPerspective”,我读到它在 Opengl 3+ 中没有使用。它不应该是 GLUT 中的一个单独的函数吗?它与 OpenGL 3+ 有什么关系?最后,Transform( Width, Height ); 是什么意思?做? (我在下载的一些示例代码中找到了它,但在 GLUT 或 OpenGL 中找不到它)。
这是代码:
GLvoid Transform(GLfloat Width, GLfloat Height)
{
glViewport(00, 00, Width, Height); /* Set the viewport */
glMatrixMode(GL_PROJECTION); /* Select the projection matrix */
glLoadIdentity(); /* Reset The Projection Matrix */
gluPerspective(20.0,Width/Height,0.1,100.0); /* Calculate The Aspect Ratio Of The Window */
glMatrixMode(GL_MODELVIEW); /* Switch back to the modelview matrix */
}
/* A general OpenGL initialization function. Sets all of the initial parameters. */
GLvoid InitGL(GLfloat Width, GLfloat Height)
{
glClearColor(0.0, 0.0, 0.0, 0.0); /* This Will Clear The Background Color To Black */
glLineWidth(2.0); /* Add line width, ditto */
Transform( Width, Height ); /* Perform the transformation */
}
/* The function called when our window is resized */
GLvoid ReSizeGLScene(GLint Width, GLint Height)
{
if (Height==0) Height=1; /* Sanity checks */
if (Width==0) Width=1;
Transform( Width, Height ); /* Perform the transformation */
}
最佳答案
I sometimes find many functions like glEnd and many more, that are not mentioned in the OpenGL 3+ documentation. Were they replaced by other functions?
它们已被完全删除,因为它们的工作方式不能很好地反射(reflect)现代图形系统在硬件和软件方面的工作方式。 glBegin(…) 和 glEnd() 形成了所谓的立即模式的环境:每次调用都会引发一个操作。这反射(reflect)了大约 20 年前早期图形系统的构建方式。
今天,我们准备一批数据,将它们传输到 GPU 内存,并通过一次绘图调用触发批量绘图。 OpenGL 通过顶点数组和顶点缓冲对象 (VBO) 来实现这一点。顶点数组自 OpenGL-1.1(1996)以来就已经存在,并且 VBO API 是建立在顶点数组之上的,因此对于任何合理的程序,都可以轻松添加 VBO 支持。
Or do I have to write them manually? Is there a tutorial online that uses OpenGL 3+?
这取决于相关功能。例如,整个纹理环境、组合器已被删除。就像矩阵操作功能和整个照明界面一样。
他们所做的和配置的现在是通过着色器和制服完成的。有人可能会说,既然您需要提供着色器,那么您就应该自己实现这一点。您很快就会发现,通常编写着色器比摆弄大量 OpenGL 参数设置调用更容易、更简洁。此外,一旦您取得了足够的进展,您就几乎不会错过矩阵操作函数。每个处理 3D 图形的严肃应用程序都会维护变换矩阵本身;无论是为了增强灵 active 还是仅仅因为其他地方也需要这些矩阵,例如一些物理模拟。
As for " gluPerspective" I have read that it isn't used in Opengl 3+. Isn't it supposed to be a separate function in GLUT? what does it has to do with OpenGL 3+? Last, what does Transform( Width, Height ); do? (I found it in some sample code I downloaded, and I can't find it in GLUT or OpenGL).
gluPerspective 是 GLU 的一部分。 GLU 是 OpenGL 实用函数的配套库,过去随 OpenGL-1.1 一起提供。然而它不是 OpenGL 规范的一部分并且完全可选。
过剩又是另一回事了。它是一个简单的框架,用于快速设置 OpenGL 窗口和上下文,并提供一些简约的输入 API。它也不再被积极维护。我个人建议不要使用它。如果必须使用 GLUT API,请使用 FreeGLUT。或者更好的是,根本不要过多,使用 Qt、GTK 等工具包或 GLFW 或 SDL 等框架。
关于OpenGL 已弃用的函数以及 gluPerspective 和 Transform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7960398/
我有一段这样的代码。我发现 myResults = writer.getBuffer().toString(); 对某些用例返回 EMPTY STRING,但对其他用例则不返回。 我查看了服务器,但在
如何使用 javascript 通过 id 更改元素中的 -webkit-transform 、-moz-transform 、-o-transform 和 -ms-transform css? 这段
我正在使用 javax.xml.transform.Transformer.transform() 通过 xsl 样式表将一个 xml 转换为另一个 xml。我想以编程方式设置第一级 child 的排
为了使 seaborn.pairplot() 正常工作,在 jupyter notebook 中执行了以下步骤。 /usr/local/lib/python2.7/site-packages/matp
假设这个输入 XML 编写这些代码行: StreamSource source = new StreamSource(new StringReader(/* the above XML*/));
如何在 spring 框架中配置 java.xml.transform.Transformer ?我需要转换器的实例来通过 xslt 将 xml 转换为文本。因此,配置的转换器应该了解 xslt 样式
我一直在核心数据中使用可转换属性,将图像和颜色等复杂对象转换为原始数据。我拿了this ... The idea behind transformable attributes is that you
我正在尝试打开 XML 文件,添加一些更改,然后保存到其他 XML 文件结果。我正在使用标准 javax.xml.parsers.* 和 javax.xml.transform* 类。 但在保存的文档
Transformer(变换方法)对输入源的大小有限制吗? 我正在尝试转换一个相当长的 (18M) XML,但收到一个奇怪的错误 "The element type "HR" must be term
我正在尝试解析一个非常简单的示例: 100 我使用的样式表如下: 这在 libxs
来自文档 for from_pretrained ,我知道我不必每次都下载预训练的向量,我可以使用以下语法保存它们并从磁盘加载: - a path to a `directory` contain
默认缓存目录磁盘容量不足,我需要更改默认缓存目录的配置。 最佳答案 您可以在每次加载模型时指定缓存目录 .from_pretrained通过设置参数cache_dir .您可以通过导出环境变量 TRA
有一个函数,例如: CATransform3DGetAffineTransform Returns the affine transform represented by 't'. If 't' ca
我有一个包含 WCF 设置的配置文件: “add”元素只有一个 baseAddress 属性,所以我不能使用 Match 定位器。一种方法如何像我的示例中那样转换多个元素? 最
在收到下面链接中描述的错误后,我已将实体属性的 Transfomer 设置为 NSSecureUnarchiveFromData(之前为 nil)。 CoreData crash error Xcod
当我写Document时使用 Transformer 的 transform() 方法转换为 XML,生成的 XML 文档的格式很好 - 所有元素都写在单独的行上并缩进。除了第一个元素与定义写在同一行
我不明白 StreamResult 实例会发生什么。我看到 Transformer 对象接收 source 和 streamResult: transformer.transform(sour
从下面的代码片段我应该得出结论,std::transform 比 boost::transform 更受欢迎,因为前者使用更少的初始化和析构函数可能更有效比后者? #include #include
transform() 可以将函数应用到序列的元素上,并将这个函数返回的值保存到另一个序列中,它返回的迭代器指向输出序列所保存的最后一个元素的下一个位置。 这个算法有一个版本和 for_each()
我是 react-native 的新手。在项目上将 react-native 从 0.48.3 升级到 0.62.2 后,运行“react-native run-ios”命令时出现错误:“index.
我是一名优秀的程序员,十分优秀!