开发者

How to make a curve vertex on OpenGL C++

开发者 https://www.devze.com 2023-04-10 22:12 出处:网络
I am learning how to make a 2D object with OpenGL. I made a simple rectangle with GL_QUADS with four vertex 3f example vertex1, vertex2, vertex3, vertex4. The question is, is there anyway so I can mak

I am learning how to make a 2D object with OpenGL. I made a simple rectangle with GL_QUADS with four vertex 3f example vertex1, vertex2, vertex3, vertex4. The question is, is there anyway so I can make a curve sides from that vertex(example : from v1 to v2 is the left side of the rectangle, I just want to know how to make a curve side f开发者_运维问答rom v1 to v2).


Use a Bezier curve or something similar to generate additional vertices.


AFAIK there is no way to draw a curve out of the box. What you could do is to draw several lines with GL_LINE_STRIP and to pass your vertices. Of course you have to create your own vertices.

There are several curve algorithms, but as genpfault states, the Bezier Curves are a good-looking starting point.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号