Page 1 of 1

Drawing OpenVG on an X Window

Posted: Tue Jun 04, 2013 8:34 am
by Velovix
I've been experimenting a bit with OpenVG on the Raspberry Pi, and it's been really interesting so far. One problem that I encountered fairly early on is the issue of reading keyboard/mouse input from the user. After looking into solutions such as using ncurses or (somehow) directly reading from the keyboard, it seemed like my best option was to get input information from X. The only problem with that is that now I have to get OpenVG to play nicely with X windows instead of just writing itself on top of whatever's going on.
Is there a simple or built-in way to draw into a window, or am I going to have to have OpenVG adjust it's drawing space to wherever the window is manually and somehow adjust to overlapping windows?

Re: Drawing OpenVG on an X Window

Posted: Wed Sep 03, 2014 4:34 am
by olso4539
I would take a look through this repository for an example. https://github.com/ricrpi/mupen64plus-rpi
It is a nintendo 64 emulator that draws opengles in an x window through egl. You should be able to swap opengles for openVG pretty easily if you can understand the rest of the x window code.

Re: Drawing OpenVG on an X Window

Posted: Wed Sep 03, 2014 8:36 am
by ric_rpi
Afraid you will have to code something up that does this manually. I started it with mupen64plus but the dispmanx/X11 implementation isn't complete especially in areas like moving windows around the screen or dealing with overlapped windows. tbh the implementation is a bit of a mess but if you are fighting with dispmanx (like I did for a month) then it will point you in the right direction.

I would also like to add that you could consider using SDL2 as an alternative to using X11 directly.
SDL can create the blank window (that you render over with dispmanx/egl) and it would also allow you to get keyboard/mouse/joysick input too. In the future if you wanted to make your program run without X11 then the user input side of your implementation would already be compatible.