在OpenGL中绘制凹多边形 [英] Drawing a concave polygon in OpenGL

查看:1251
本文介绍了在OpenGL中绘制凹多边形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在OpenGL中绘制凹面多边形。

多边形定义为形成其外环的点列表,以及定义其内部的列表列表戒指(禁区)。

I have a concave polygon I need to draw in OpenGL.
The polygon is defined as a list of points which form its exterior ring, and a list of lists-of-points that define its interior rings (exclusion zones).

我已经可以处理禁区了,所以如何绘制没有内环的多边形的解决方案也不错。

I can already deal with the exclusion zones, so a solution for how to draw a polygon without interior rings will be good too.

Boost的解决方案。几何将是好的,因为我已经在我的应用程序中大量使用它。

A solution with Boost.Geometry will be good, as I already use it heavily in my application.

我需要这个才能在iPhone上运行,即OpenGL ES(带有固定管道的旧版本)。

I need this to work on the iPhone, namely OpenGL ES (the older version with fixed pipeline).

我该怎么做?

推荐答案

尝试OpenGL的镶嵌设施。您可以使用它将复杂多边形转换为一组三角形,您可以直接渲染它们。

Try OpenGL's tessellation facilities. You can use it to convert a complex polygon into a set of triangles, which you can render directly.

编辑(作为对评论的回应) :OpenGL ES不支持细分功能。在这种情况下,如果多边形是静态数据,您可以使用台式机或笔记本电脑上的OpenGL离线生成曲面细分。

EDIT (in response to comment): OpenGL ES doesn't support tessellation functions. In this case, and if the polygon is static data, you could generate the tessellation offline using OpenGL on your desktop or notebook computer.

如果形状是动态的,那么你对于OpenGL ES来说运气不好。但是,有许多库(例如, CGAL )将执行相同的功能。

If the shape is dynamic, then you are out of luck with OpenGL ES. However, there are numerous libraries (e.g., CGAL) that will perform the same function.

这篇关于在OpenGL中绘制凹多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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