Page 1 of 1

Good vector graphics library for video games?

PostPosted: 08 May 2014, 21:26
by grrk-bzzt
Hello,

For a long time I was wondering if an equivalent of SDL for vector graphics existed.
I would like to make a 2D game with simple vector shapes such as lines and circles that you can zoom in and out.

Do I have to go with a 3D library to do that? Or does a 2D lib exist for such job?

Re: Good vector graphics library for video games?

PostPosted: 09 May 2014, 00:20
by smcameron
Bill Kendrick (the guy that made defendguin, among other things) was working on something called libcrtxy for awhile. Not sure what the status is these days and I never tried to use it, but it looks like it might be kind of what you're looking for.

http://libcrtxy.sourceforge.net/

Edit: If you can draw lines, and you're talking strictly 2D, it's trivial to zoom in and out (simple scaling and translation in x and y -- and "scaling" and "translation" just mean literally multiplying and adding, respectively.) you certainly do not need a 3d library for that, or a library of any sort. Zooming in and out in 2d vector graphics amounts to multiplying and adding.

Edit: ok, zooming in/out may also involve clipping. Liang-barsky clipping is pretty trivial though Here's my implementation in C.

Re: Good vector graphics library for video games?

PostPosted: 05 Sep 2014, 15:58
by dusted
You could hardware-accelerate those lines with OpenGL, it has a line function (atleast last time I checked, waay back in version 2.something ) :)
Have a look at osgg to see how not to make a vector game in OpenGL.

Re: Good vector graphics library for video games?

PostPosted: 05 Sep 2014, 16:39
by NaN
There is https://github.com/memononen/nanovg

Havent used it myself, so not sure how good it is.

Re: Good vector graphics library for video games?

PostPosted: 11 Sep 2014, 23:01
by Aitch
There is no difference between 2D and 3D anymore! The rendering of triangles is the thing the graphic cards are optimized. Just use the correct projection. Mostly the games use the third dimension for z-order the objects. Doesn't matter which library you use nowadays, they might only help you to describe your vertices in 2D, but 3D will always be used.