我们如何获得 glDrawElements() 的索引?

发布于 2024-09-16 06:59:04 字数 203 浏览 0 评论 0原文

我正在尝试使用 Assimp 库将模型导入到使用 VBO 的基本 OpenGL 应用程序中。

如果我理解正确的话,glDrawElements 是绘制事物的理想现代方法之一。

但是我们如何从通用导入库中获取这些信息呢?

如果您有具体的 Assimp 库知识,我们将不胜感激。

--

生成这些的过程通常是怎样的?

I'm trying to use the Assimp library to import models to a rudimentary OpenGL application with VBO use.

If I understand it correctly glDrawElements is one of the ideal modern ways to draw things.

But how do we get that information from a generic import library?

If you have specific Assimp library knowledge it's appreciated.

--

What is generally the process to generate these?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

今天小雨转甜 2024-09-23 06:59:04

在单个缓冲区中收集来自 aiMesh::mFaces 的所有索引。确保将 aiProcess_Triangulate 作为后处理标志传递给 Assimp(在 aiProcess_JoinVertices 以及任何对您有用的内容中),并跳过点和线或单独处理它们。

aiMesh 中的各种数据流 - 例如 aiMesh::mVerticesaiMesh::mNormals 需要设置为 GL 输入数据流(<代码>glVertexPointer,...)。

Collect all indices from aiMesh::mFaces in a single buffer. Make sure to pass aiProcess_Triangulate to Assimp as postprocessing flag (amongst aiProcess_JoinVertices and whatever seems useful to you), and skip over points and lines or handle them separately.

The various data streams in aiMesh - such as aiMesh::mVertices and aiMesh::mNormals need to be set as GL input data streams (glVertexPointer, ...).

乄_柒ぐ汐 2024-09-23 06:59:04

文档来看,它看起来像aiFace::mIndicesaiMesh::mFaces 索引到 aiMesh::mVertices

aiVector3D 看起来的布局使得您应该能够仅使用 mVertices 调用 glVertexPointer() 并使用 mIndices< /code> 直接在 glDrawElements() 调用中。

From the documentation it looks like the aiFace::mIndices from an aiMesh::mFaces index into aiMesh::mVertices.

aiVector3D looks like it's laid out such that you should be able to able to just call glVertexPointer() with mVertices and use mIndices directly in your glDrawElements() call.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文