Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualServant of the Lord

Posted 26 January 2013 - 01:28 PM

I've never dealt with vector images myself, but here's what little I understand: .svg is the most common and popular vector art format.

 

SDL doesn't have knowledge of vector graphics. I don't think OpenGL natively does either. OpenVG is an API for hardware accelerated vector graphics. 

But that's not really what you want anyway, because SDL doesn't need to know about vector graphics.

 

Imagine this: You have your GUI images in vector graphics.

Your game is loaded, your resolution is set to 1920x1280, so you use your vector graphics to generate bitmap images of the sizes you want. Then, you give the generated pixel data to SDL and SDL draws them like normal. The user resizes the game to 1024x768, and you use your vector graphics to generate bitmaps at a new size that you then pass to SDL. You don't need to generate the bitmaps every frame, just once whenever you want a new size.

 

So, you'll want a third-party library that is independent of drawing graphics, and doesn't require a window, to load a vector image and generate pixel data at various sizes for you. Something small, compact, and simple that you can plug easily into your existing program.

 

Which library that would be, I'm not sure. Perhaps librsvg, but that has two other dependencies (libxml and Cairo, and I'm not sure how hefty Cairo is). There's an outdated third-party SDL_svg library, but it's pretty old. Maybe download that and see how it works? I just stumbled across AGG, perhaps that might work.

 

You'd have to deal with resizing text too, if your GUI text is dynamic, but that's a separate topic and you're probably using SDL_ttf anyway.


#1Servant of the Lord

Posted 26 January 2013 - 01:25 PM

I've never dealt with vector images myself, but here's what little I understand: .svg is the most common and popular vector art format.

 

SDL doesn't have knowledge of vector graphics. I don't think OpenGL natively does either. OpenVG is an API for hardware accelerated vector graphics. 

But that's not really what you want anyway, because SDL doesn't need to know about vector graphics.

 

Imagine this: You have your GUI images in vector graphics.

Your game is loaded, your resolution is set to 1920x1280, so you use your vector graphics to generate bitmap images of the sizes you want. Then, you give the generated pixel data to SDL and SDL draws them like normal. The user resizes the game to 1024x768, and you use your vector graphics to generate bitmaps at a new size that you then pass to SDL. You don't need to generate the bitmaps every frame, just once whenever you want a new size.

 

So, you'll want a third-party library that is independent of drawing graphics, and doesn't require a window, to load a vector image and generate pixel data at various sizes for you. Something small, compact, and simple that you can plug easily into your existing program.

 

Which library that would be, I'm not sure. Perhaps librsvg, but that has two other dependencies (libxml and Cairo, and I'm not sure how hefty Cairo is). There's an outdated third-party SDL_svg library, but it's pretty old. Maybe download that and see how it works?

 

You'd have to deal with resizing text too, if your GUI text is dynamic, but that's a separate topic and you're probably using SDL_ttf anyway.


PARTNERS