OpenCV + OpenGL control

This is a short post to announce that I have rewritten all the core management of types and attributes (see this post: patch vs view). This was a pretty big change but we now have an “attributes” field in every object in which we can store about anything that we need.

Since I had to fix many tests, I also decided to fix the control of rubyk systems running OpenGL.

As some of you may know, OpenGL is an API that is Thread-contextual. This means you have one global OpenGL context per thread. When you call gl.Color(0.5,0.5,0.0,0.5), you are changing the current thread’s OpenGL context.

Because of this, and since Rubyk is massively multithreaded oriented, I had a couple of problems updating and getting parameters from GLLua scripts.

I am happy to tell you that this has been fixed and that I could control OpenCV blur and cube rotation from Mimas !

opencv control

Changing live video effect from Mimas.

The sliders do not have labels yet. These are:

  • /win/open_close (open or close window)
  • /cv/x (x rotation angle)
  • /cv/y (y rotation angle)
  • /cv/z (z rotation angle)
  • /cv/opacity (live video opacity)
  • /cv/blur (live video cv.blur size)

You can run this example from your rubyk’s build directory:

cd build
cp ../examples/GLLua/opencv.json ./
./rubyk ../examples/GLLua/opencv.rk
Gaspard Bucher


  1. leave a comment