ofxShivaVG (Smooth 2d graphics in oF)

I’ve been doing a lot of research lately on how to best draw smooth thick lines in OpenGL, as my attempts with cairo/quartz just doesn’t provide the performance I need. See this thread: http://forum.openframeworks.cc/t/ofxcairo-[performance-issues]/12548/0

I came over this brilliant collection of articles on the subject in the oF github repo:
https://github.com/openframeworks/openFrameworks/issues/1190

Wich again led me to this post by Ivan Leben on his OpenGL implementation of the OpenVG standard:
http://ivanleben.blogspot.no/2007/07/shivavg-open-source-ansi-c-openvg.html

Turns out, it works remarkably well!

I’ve been working on an implementation for openFrameworks for the last couple of days and things are starting to shape up. Check out this screenshots for how it compares to the normal renderer:

Default renderer:

ofxShivaVGRenderer

Without doing any thorough benchmarking I can still say that the performance is quite good. (About 10x faster then cairo and with 1/10 of the cpu usage).

It is implemented as a renderer that extends the built in openGL renderer, overriding drawing of paths and polylines (right now it only supports 2d polylines), while leaving rendering of 3d graphics as is.

You can get the code here: https://github.com/bgstaal/ofxShivaVG

Let me know if you have any issues with it!

1 Like

Wow this looks amazing…nice work! I just downloaded it and gave the example a try, crazy how different the results are.

I did have one issue with it, the example won’t compile on 10.6.8 unfortunately, I think because of the older xcode (4.2) and you seem to be using some C++ stuff that doesn’t work quite right. 10.8 it worked no problem though.

Hi!

This looks great :slight_smile:

But i can’t compile any example!!!
I got this error:

I’m on osx 10.9, OF 0.08 and xcode 5.0.2

Any ideas? i really want to try this…

best
j

It looks like you’re trying to use the tr1 namespace in C++11 somehow. Check your compiler settings in XCode. This particular problem is referenced here: https://github.com/openframeworks/openFrameworks/issues/2335 I don’t have XCode 5 so I’m not sure what it defaults to but tr1 (I think) is only supported in C++98

hi joshua!

I solve the problem by create a new project with the project generator and and copy the testApp.h and .cpp to the new project. Most of the examples from the addons have this problem. Probably because the projects are not compatible with the new xcode or the new OF.

best

I can’t compile the example on 0.8.0 (10.9 and Xcode 5)
I changed sdk/deployment to 10.8 but doesn’t compiles fine.

Undefined symbols for architecture i386:
“_CVDisplayLinkRelease”, referenced from:
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
“_CVDisplayLinkCreateWithCGDisplay”, referenced from:
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
“_CVDisplayLinkGetNominalOutputVideoRefreshPeriod”, referenced from:
_vidmodeFromCGDisplayMode in libglfw3.a(cocoa_monitor.m.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

any help? must update to 0.8.1?

Hey. Those issues you are seing are related to newer versions of OF being using glfw for OpenGL-context setup and windowing and the examples are built against an earlier version of OF.

Basically there’s just a library not linked to in the old example projects. I have updated the examples on github now. You can pull the changes or fix it yourself by adding corevideo.framework to your project.

2 Likes

Thanks a lot again for the fast reply man! :smile:
Now I make it work on 0.8.0 / XCode5 / 10.9

(I don’t now if I am doing fine, but I didn’t see any update to the github repo, and do not worked after syncing…)

Anyway, I just added the CoreVideo.framework to the target project and it worked !!

I’ll check with the 0.8.1 and i’ll post here after.

EDIT:
working on 0.8.1 too after adding framework

I trying to make ShivaVG running on Windows, but I get lots of compilation error with shiva lib itself.
Errors are mainly conversion or casting errors like “cannot convert from ‘SHuint32’ to ‘VGPathAbsRel’”.
Does anyone have a tip on how to get it working on Windows ?

This addon is really nice – the rendering is much improved. For anyone who uses this addon, has anyone noticed any performance issues, as compared to the default renderer? If not, I see no reason not to use it all the time.

answering my own question here – ran some tests and it does seem that drawing a large number of lines, there is a solid drop, up to 50% in frame rate for me using the shiva renderer. i wonder if anyone has any other insights into this – is dynamically switching renderers for certain graphical subtasks (lines/curves especially) a good way to get best of both worlds?

Hi, I get this error when compiling in OSX 10.10 (from actual GIT repo).
This error is appearing when compiling the example, or when compile an empty app generated with Project Generator too.

I am using the OF from the git repo up to date.

https://github.com/bgstaal/ofxShivaVG/issues/5

1 Like

This add-on looks great. I’ve been struggling for much of the day getting smooth shapes. I’m also on Windows. Unfortunately, I hit a very similar issue:

Error 1 error C2440: ‘initializing’ : cannot convert from ‘VGfloat’ to ‘VGPathDatatype’ c:\users\cory barr\projects\openframeworks\of_v0.8.4_vs_release\of_v0.8.4_vs_release\addons\ofxshivavg\libs\shivavg\src\shvgu.c 32

Is anyone using ofxShivaVG on Windows with oF 0.8.x?

Has anyone tried this addon on the current openframeworks/master? Using @procedural’s fork it compiles (after adding CoreVideo to the project) but I get a weird result:

@mattfelsen everything should work correctly now: https://github.com/ofnode/ofxShivaVG

I’m not often on forums so feel free to open issues on github page so I could fix them more quickly!

Thanks for keeping this up to date :smile:

Hey guys, Im trying to use this addon with the latest version of openFrameworks v0.9.2

How do I make it work?

I really need rounded caps on strokes, which is why I want to use this addon.

1 Like

I’m having trouble too
Issues with circle, ellipse and simply not smoothing: OS X 10.11, OF 9.3, Xcode 7.3
I posted an issue on GitHub here: https://github.com/bgstaal/ofxShivaVG/issues/7

also encountered with type cast error on Windows using OF 0.9.8 …
anyone knows the solution? thanks!