pouët.net

wanted: really simple vector tool, with simple file format.

category: code [glöplog]
 
I want a tool which I can edit and make lines from simple pairs of points for use in an OpenGL app with a very simple file format.

The issue isn't the GL side, its just getting things in a usable format. For the most part I have them in SVG format already (in Inkscape), and I was thinking of writing a tool to convert the path element in SVG from the shape into what I need.

Amongst other things this involves the hershey vector font. However, if a tool already exists it'd save me a bunch of time writing one.

As they're very simple I want to store the shapes in hardcoded arrays so file formats don't matter, I don't mind converting from an existing simple format to that, but I was wondering if a tool already exists that is very close enough to what I need to save me the work.

I'm literally talking about something that allows shapes/glyphs to be built using pairs of lines and exported as an array close to how you'd store them in OpenGL.

Thanks!
added on the 2015-07-13 18:26:41 by Canopy Canopy
Blender can load .svg and export it into quite a number of typical mesh formats. So if you have loader code for any of those, that would probably be easiest.

Of course, I would never reccomend .obj to anybody, since it is a horrible mess... but it *is* simple.
added on the 2015-07-13 18:35:02 by urs urs
seem like you want something pretty specific, why not just code it?
added on the 2015-07-13 19:04:30 by psenough psenough
10: Use the "Make selected segment lines" feature in Inkscape. It converts curves into a series of connected lines.

If that doesn't work, use "Convert to Paths" then goto 10.
Yeah that was the plan.. but if something exists that is super close in editor form that i can make a simple converter for that doesn't require me to put together a half-assed thing to do the job its a win and I can spend more time on the good stuff :)

For the most part i could do it on paper, by hand, its that simple, and it might be just as fast as making a little editor, i'm just thinking something similar out must exist out there that i can leverage so i don't have to reinvent the wheel.

I dont mind writing or retooling existing loader code to spit out an array for my use. i'm just thinking something must exists out there already.

the original hershey (custom format files) is out there, plus part of the font set exists here as a C array (on the page) http://paulbourke.net/dataformats/hershey/ and the rest is dotted around the net - including SVG conversions.

i want to leverage as many existing tools as possible to get things through to me in the right format..
so blender converting sounds great - i just don't know what format to use yet!

maybe converting each one from svg to .obj would be good as i know there are tons of editors and resources out there for that, even it if is messy. then i can use a loader/array convertor from "known good" files that load in a variety of software so i'm not dealing with anything too niche

ignore the glow, but the goal is a scalable font, and icons (including custom ones I make) like this https://github.com/blucz/Vector/blob/master/images/testpattern.png (this project also contains the C array from the page above)
added on the 2015-07-13 20:36:02 by Canopy Canopy
(my reply was to psenough btw)

thanks for the tip █▄ █▄█ █ ▄█▀!
added on the 2015-07-13 20:37:05 by Canopy Canopy
I use LibreOffice Draw. It can export to a variety of formats
Try blender and export your object to PLY format.

This format is very simple (read the link above) and surely you will adapt it to your needs very quickly.
added on the 2015-07-14 05:01:25 by ham ham
Export to HPGL (Inscape calls it .plt plot file). It handles only line segments (no fill, colors or even splines), but vector formats really can't get much simpler than that. And if you really need your paths smooth, apply Catmull-Rom on top of it.
added on the 2015-07-14 10:29:10 by KK KK
Thanks, i'll look into that, PLY format looks more suitable, but the pointer towards Catmull-Rom is very very useful as I was wonder how well it'd scale on high-res/high-DPI displays.

Quote:
Try blender and export your object to PLY format.

This format is very simple (read the link above) and surely you will adapt it to your needs very quickly.

Thanks, looks really good.

Seems like a plan might be, export each unique "character" to individual .ply files e.g. A.ply, B.ply plus MyIcon.ply and so on, then write a little tool to process each one, and appened parsed file to a header as a C style array, I can then create a character/identifier lookup on the fly for the ones I use.

For example, in Windows builds I already have my logging going to a console window. One thing I want to use it for is to log to an overlay layer when fullscreen (or on other platforms). It could be used to make a lightweight FPS counter, debug console, shader viewer/editor etc. (I'm using modern GL on desktop, and will be using ES on mobile, so no inbuilt font support thats cross-platform, and don't really want to drag in something like freetype..)
added on the 2015-07-14 11:16:58 by Canopy Canopy
(btw just for clarification this isn't just for debug/fps counter output!)
added on the 2015-07-14 12:06:04 by Canopy Canopy
So I've had a quick look before work while I have a coffee :)

I tried the blender route.. and it fails to export the PLY from the SVGs.. its also going to be more fiddly for this task.

Quote:
Export to HPGL (Inscape calls it .plt plot file). It handles only line segments (no fill, colors or even splines), but vector formats really can't get much simpler than that. And if you really need your paths smooth, apply Catmull-Rom on top of it.


So I looked at this briefly.. and it looks like the preferable route now. Partly because its all done in Inkscape, and more other tools appear to support HPGL than PLY.


Confusingly inkscape supports two similarly named 'hpgl' types.

.plt "HP Graphics Language Plot File"
.hpgl "HP Graphics Language File"

they look pretty much the same, with a subtle difference. with the .hpgl one dpi can be specified

So my test prog will enumerate *.hpgl or .plt in its folder, load it, scale it and the left right arrow will cycle to next/prev file on-screen. pressing 'S' will save inputfile.hpgl to inputfile.h as an array, and then a batch mode to this will work as I outlined before by append each file converted to an array to a specified header file.
added on the 2015-07-23 09:42:07 by Canopy Canopy
I edit svg files with inkscape and forked apache batik to my needs.
added on the 2015-07-23 11:53:41 by krabob krabob

login