属性除数不实例? [英] Attribute divisor without instancing?

查看:114
本文介绍了属性除数不实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 glVertexAttribDivisor 可用于修改通用顶点属性在实例渲染过程中的提升速率,但我想知道是否有任何方法提高属性无特定速率。

I know that glVertexAttribDivisor can be used to modify the rate at which generic vertex attributes advance during instanced rendering, but I was wondering if there was any way to advance attributes at a specific rate WITHOUT instancing.

下面是一个例子:

假设你定义了一个顶点位置列表组成一系列行,并且每行都希望关联一个ID。所以,你创建两个vbos,每个vbos容纳与这些属性之一相关的数据(所有顶点位置或所有顶点ID)。传统上,这意味着每个vbo必须是行数X 2的大小(在元素中)(因为每个点包含两行)。这当然意味着我为一行中的每个点复制相同的ID值。

Let's say you are defining a list of vertex positions that make up a series of lines, and with each line you wish to associate an ID. So, you create two vbos that each house the data related to one of those attributes (either all the vertex positions or all the vertex IDs). Traditionally, this means each vbo must be the size (in elements) of the number of lines X 2 (as each point contains two lines). This of course means I am duplicating the same ID value for each point in a line.

我想要做的是指定ID为每2个元素提前1个元素顶点位置缓冲区前进。我知道这需要我的顶点位置缓冲区首先声明(所以我可以引用它告诉OpenGL多久前进ID缓冲区),但它仍然似乎是可能的。然而,我找不到任何允许这样的操作的OpenGL规范中的功能。

What I would like to do instead is specify that the IDs advance 1 element for every 2 elements the vertex position buffer advances. I know this requires that my vertex position buffer is declared first (so that I may reference it to tell OpenGL how often to advance the ID buffer) but it still seems like it would be possible. However, I cannot find any functions in the OpenGL specification that allow such a maneuver.

推荐答案

你想要的是在OpenGL中通常不可能。它实际上是一种克制形式的多索引渲染,因此您必须使用这些技巧之一,得到它。

What you want is not generally possible in OpenGL. It's effectively a restrained form of multi-indexed rendering, so you'll have to use one of those techniques to get it.

这篇关于属性除数不实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆