简体   繁体   English

使用LWJGL在glDrawElements中偏移

[英]Offset in glDrawElements using LWJGL

I'm trying to render only some of the Indices stored in the index buffer of an VAO. 我正在尝试仅呈现一些存储在VAO的索引缓冲区中的索引。

glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, 0);

I know that the second parameter is the count of vertices to draw, in this case one triangle and the last parameter is the offset as a pointer. 我知道第二个参数是要绘制的顶点数,在这种情况下为一个三角形,最后一个参数是作为指针的偏移量。 But how do I specify this pointer using LWJGL/Java? 但是,如何使用LWJGL / Java指定此指针?

Oh. 哦。 I just have to specify the offest in bytes. 我只需要指定字节数即可。 I use floats, so to start at the scond triangle I would have to set the last parameter to 3 * 4. 我使用浮点数,因此从第二个三角形开始,我必须将最后一个参数设置为3 * 4。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM