
Seems like should be fine to make an updated library that uses the transformation approach?Voidious wrote:The real fast way to do things is to create paths for the shapes I want to use up front, then use transformations to translate / rotate / scale a path each time I want to draw one of it. Unfortunately this means doing almost everything manually with the OpenVG API instead of having the luxury of ajstarks' awesome library functions
Oh right, the caching of different sizes is supposed to be for font hinting ...Chinasaur wrote:Hmm, but this brings up the question: wouldn't it be better to just cache one font size and use transformations to do the different sizes? I'm planning to dig into the font stuff a little anyway, so will take a look.
This is the approach I have been taking... but I clearly don't understand the pipeline properly as a path seems to be invlidated after it is rastorized... I can't figure it outChinasaur wrote:Seems like should be fine to make an updated library that uses the transformation approach?Voidious wrote:The real fast way to do things is to create paths for the shapes I want to use up front, then use transformations to translate / rotate / scale a path each time I want to draw one of it. Unfortunately this means doing almost everything manually with the OpenVG API instead of having the luxury of ajstarks' awesome library functions
Thanks for the example this has been immensely helpful in seeing how VG handles basic geometric shapes.ajstarks wrote:See: https://gist.github.com/3186193 for an example program that draws random shapes on the Raspberry Pi:
Also check out https://github.com/ajstarks/openvg for a library built from the example.jwzumwalt wrote:Thanks for the example this has been immensely helpful in seeing how VG handles basic geometric shapes.ajstarks wrote:See: https://gist.github.com/3186193 for an example program that draws random shapes on the Raspberry Pi:
ajstarks wrote:In this update:
https://gist.github.com/3196007
I've added more shapes (lines, polygon, polyline, cubic and quadratic bezier curves, arc, circles) and the ability to control the number of objects on the command line.
Here's the Makefile:to run it:Code: Select all
shapes: shapes.c cc -Wall -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -o shapes shapes.c -L/opt/vc/lib -lGLESv2
1) download the gist, save it as shapes.c
2) copy the Makefile to the same directory
3) make && ./shapes 100
4) just press [Enter] to clear the screen and return
During development, on my Mac sitting next the RasPi, I open two terminals and ssh into the RasPi with each. In one terminal, I edit the file, in the other, issue the make && ./shapes command to see the result.
The file that should be named font2openvg.cpp is incorrectly named font2opencv.cppajstarks wrote:sorry, I don't see the mis-spelling
OpenVG on the raspberry pi is capable of much, much faster drawing. I'm working on a plotting application that draws around ~8000 line segments per frame at 60 fps. While the library that ajstarks built is pretty awesome, it can't compete with digging into the openVG specification and doing optimizations.Voidious wrote:Just finished quite a bit of fiddling. Got a ~10% gain from removing the red/green/blue/alpha size = 8 settings from the attribute_list for eglChooseConfig, and another ~15% by caching and re-using the VGPaths and VGPaints (also need to clear the VGPaths) instead of repeatedly creating and destroying them.
So I went from ~38 to ~47 FPS when I'm drawing 4 rectangles, 10 circles, and 10 line segments. Which I'm pretty happy about, but it still feels a few orders of magnitude from where it could be. =)
Edit: And further on up to ~51 FPS by eliminating a bunch of calls to setstroke / setfill / StrokeWidth, drawing the 10 same colored circles and then the 10 same colored line segments instead of alternating.
You can use vgRotate(angle); to set a rotation, all subsequent drawing will have the transformation applied until the transform matrix gets reset. Note that there are 5 separate transform matricies, the three main ones are VG_MATRIX_PATH_USER_TO_SURFACE, VG_MATRIX_IMAGE_USER_TO_SURFACE, VG_MATRIX_GLYPH_USER_TO_SURFACE, by default you will be manipulating the path matrix, you change which matrix to modify with vgSeti (VG_MATRIX_MODE, matrix);. You can reset the matrix back to default with vgLoadIdentity().rodizio wrote:I'm using this code based on the OpenVG library to display an on screen display (text and graphical elements) on the Raspberry:
https://github.com/SamuelBrucksch/wifibroadcast_osd
Now I would like to rotate the whole OSD (i.e. everything) 270 degrees since I'm using a portrait mode 1080x1920 screen in landscape orientation. Is there a simple way to do that with OpenVG?
If you want to rotate around a given point (like the centre of the screen) you need to translate before and after the rotate, something likerodizio wrote:Thanks for the good explanation, will give it a try. The thing with the rotation around 0,0 probably explains why stuff didn't show up anymore with my failed attempts so far, I rotated it off the screen
Code: Select all
vgTranslate(width/2.0f, height/2.0f);
vgRotate(270); // or 90 depending on which way
vgTranslate(-width/2.0f, -height/2.0f);
Users browsing this forum: No registered users and 0 guests