gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Drawing curves

#173666 - Rajveer - Fri Apr 23, 2010 12:31 am

How would I go about drawing a Bezier curve? Lines can be drawn by using a polygon with 2 vertices being the same, and I guess you can draw thicker lines with a quad of variable width, but what's the best way to go about drawing a curve? As a bunch of line segments one after another (with either a single polygon, or quad for controlling width)?

#173672 - Miked0801 - Fri Apr 23, 2010 5:12 am

Probably. It's either that or drawing pixels on a texture / background in bmp mode.

#173685 - Rajveer - Fri Apr 23, 2010 10:27 am

Cool, I thought I'd end up having to sacrifice a few polygons for it. The texture in bmp mode, do you mean by creating an image of the spline and setting that as the background, or in real-time actually checking where the spline intersects the screen pixels and colouring those pixels?

#173691 - elhobbs - Fri Apr 23, 2010 5:55 pm

is this 2d or 3d?

#173692 - Rajveer - Fri Apr 23, 2010 5:58 pm

This will be in 3D with the camera moving around all axes, so I guess that rules out the texture on a background method!

#173693 - Miked0801 - Fri Apr 23, 2010 6:19 pm

Even in 3D mode, you have access to 2D bitmap planes external to the 3D system. I was thinking something along the lines of a putPixel() type routine onto this 2D plane. But if this curve has to sort in between other 3D polys, this will not work and you'll need to use polys.

#173694 - Rajveer - Fri Apr 23, 2010 7:02 pm

Hmm I forgot about sorting, ok looks like polygonal line segments are the way to go, thanks :-)