Search code examples
c++cdrawingsdl

Drawing list of points in SDL?


If i have an array of coordinates for a path(Such as in a paint program), what is the best way to render the entire path with SDL?

I looked at setting pixels individually, but from what i've seen that's a bad idea.

I also thought about drawing all the coordinates as SDL_Rect's, but rendering a large list of rect's each frame sounds slow.

Is there a simple way of achieving this effect?


Solution

  • You can implement yourself the Bresenham line algorithm directly accessing the framebuffer but I think you'll be doing much better using OpenGL...