Good vector graphics library for video games?

Good vector graphics library for video games?

Postby grrk-bzzt » 08 May 2014, 21:26

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?
User avatar
grrk-bzzt
 
Posts: 23
Joined: 05 Feb 2014, 19:52

Re: Good vector graphics library for video games?

Postby smcameron » 09 May 2014, 00:20

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.
smcameron
 
Posts: 377
Joined: 29 Oct 2010, 23:44

Re: Good vector graphics library for video games?

Postby dusted » 05 Sep 2014, 15:58

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.
User avatar
dusted
 
Posts: 83
Joined: 27 Feb 2010, 04:35

Re: Good vector graphics library for video games?

Postby NaN » 05 Sep 2014, 16:39

There is https://github.com/memononen/nanovg

Havent used it myself, so not sure how good it is.
NaN
 
Posts: 151
Joined: 18 Jan 2010, 10:32

Re: Good vector graphics library for video games?

Postby Aitch » 11 Sep 2014, 23:01

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.
Aitch
 
Posts: 1
Joined: 11 Sep 2014, 22:46

Who is online

Users browsing this forum: No registered users and 1 guest