rive-cpp-legacy icon indicating copy to clipboard operation
rive-cpp-legacy copied to clipboard

Example using rive and skia

Open projectitis opened this issue 4 years ago • 4 comments

Hi there,

I'm trying to get rive and skia working in a GLFW window but am having trouble. I've only got the old flare examples to go on that I've been able to find. However, a lot seems to have changed since these were written.

Do you have a simple example of at least rendering a rive file to a surface using skia?

Thank you!

projectitis avatar Jul 24 '21 08:07 projectitis

~~Hi! This is an old experimental repo for the Flare C++ runtime! The new Rive one with working Skia renderer (see the Skia/viewer folder) is here: https://github.com/rive-app/rive-cpp~~

luigi-rosso avatar Jul 24 '21 18:07 luigi-rosso

Leaving that comment for posterity, I totally misunderstood.

You have the right repo, wrong examples! You can export new compatible files (v7) from https://rive.app. You can open any file in the community and download the runtime (.riv) file for it.

luigi-rosso avatar Jul 24 '21 18:07 luigi-rosso

Thanks for the answers (and for the fantastic product) Luigi - sorry, I should be more clear. I am developing a c++ app:

  1. Create GL window with GLFW (working fine)
  2. Create Skia GL context and surface (working fine)
  3. Draw manually to window using skia (e.g. draw rectangles, lines - working fine)
  4. Load .riv file and draw using skia <-- this is the part I'm having trouble with

For the last step I am trying to use the old flare example as a reference, but rive has changed so much since then. The code is not directly compatible (for example, I cannot find anything called an SkrActor) and there are no example projects in the new rive cpp repo.

Do you have an example of how to render any .riv file using skia once GL and skia are set up and ready?

projectitis avatar Jul 24 '21 20:07 projectitis

In case anyone comes across this in the future, there is a good example in the repo but it's a bit tricky to find :) https://github.com/rive-app/rive-cpp/tree/master/skia/viewer

projectitis avatar Jul 28 '21 09:07 projectitis