Karate_Dog
Karate_Dog

Reputation: 1277

How to make a curve vertex on OpenGL C++

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 from v1 to v2).

Upvotes: 2

Views: 1035

Answers (2)

Constantinius
Constantinius

Reputation: 35069

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.

Upvotes: 2

genpfault
genpfault

Reputation: 52122

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

Upvotes: 2

Related Questions