表面积计算
我使用 glDrawArrays(GL_POINTS,...) 来绘制谐波。 我想知道 openGL 在基于顶点渲染时生成曲面(三角形?)的顺序 并以这种方式计算表面积? 我可以做吗?如果可以的话怎么做?
我会尝试更好地解释它,
我有 2D 值数组并对其执行 uv 映射。(我生成谐波) 并使用 glDrawArrays 绘制接受的表面。 我想计算我可视化的表面积。 我认为我应该通过创建三角形网格来“翻译”问题,以便更容易进行此类计算, 适合点绘制 - 这将简化我的计算。
I use glDrawArrays(GL_POINTS,...) to draw harmonic wave.
I would like to know the order in which the surfaces (triangles?) are generated by openGL while rendering based on the vertices
and in such a way calculate the surface area?
Can I do it and if yes how.
I will try to explain it better
I have 2D array of values and perform uv-mapping on it.( i generate harmonic wave)
and draw the surface accepted using glDrawArrays.
I want to calculate the surface area,which i visualize.
I think I should "translate" the problem to be easier for such calculation by creating a grid of triangles ,
which is suitable for points drawing - this will simplify my calculation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
点没有曲面。
OpenGL 不生成三角形。它会对您发送的三角形进行光栅化。按照您指定它们的顺序。
glDrawArrays(mode,first,count)
行为与基元按照指定的顺序进行光栅化。
所以你想知道表面积,但要知道画点。正如已经说过的,点(在数学上)没有表面。然而,它们至少覆盖一个(子)像素。那么您是否真的想知道像素覆盖范围?
然后 OpenGL 为您提供了一种称为“遮挡查询”的方法,使用该方法可以返回通过在查询中绘制图元而触摸了多少(屏幕/帧缓冲区)像素。
http://www.opengl.org/registry/specs/ARB/occlusion_query.txt
Points have no surface.
OpenGL doesn't generate traiangles. It rasterizes the triangles you send it. In the very same order in which you specify them.
glDrawArrays(mode, first, count)
behaves exactly likeThe primitives are rasterized in the order they are specified.
So you want to know a surface area, but are drawing points. As already told, points (mathematically) have no surface. However they cover at least one (sub-)pixel. So could it be that you actually want to know the pixel coverage?
Then OpenGL provides you a method called "occlusion query" using which it returns you, how many (screen/framebuffer) pixels got touched by drawing the primitives within the query.
http://www.opengl.org/registry/specs/ARB/occlusion_query.txt
几何着色阶段包含有关绘制的多边形的信息,因此您可以从那里计算表面量。为了获得其总和,您可以使用加法混合渲染到 1x1 R_32F 帧缓冲区对象中,然后将值读入系统内存。
The geometry shading stage contains the information about drawn polygon, so you can calculate the surface amount from there. In order to get the sum of it you can render into 1x1 R_32F framebuffer object with additive blending, then read the value into system memory.