Stupid QC tricks – transparent QC Window

EDIT: Ive updated the code to allow the app to run at the desktop/normal app/or floating above all other apps, as well as work with key/mouse events and choose the target QC composition.

This is actually kind of cool, and potentially useful, and certainly pretty… Here is an XCode project demonstrating how to create a transparent, borderless window, with a properly setup openGL context to render a transparent QC composition on your desktop. There are a few gotchas, and the important bits are:

* Make sure your NSWindow’s backing store is NSBackingStoreBuffered
* Make sure your NSWindow is setOpaque:NO
* Make sure your NSWindow’s background color is [NSColor clearColor]
* Set your OpenGL context’s NSOpenGLCPSurfaceOpacity to 0 via setValues forParameters method
* and finally make sure you are using a double buffered pixel format.

The XCode project also demonstrates how to enable multisample antialiasing in OpenGL, which makes things that much prettier. So, what does that get you in the end? (click to open a movie). Click here to download the source

5 Responses to “Stupid QC tricks – transparent QC Window”

  1. toby*spark Says:

    nicely done. nswindow – no problem. opengl contexts – thats some voodoo magic as far as i’m concerned =]

  2. Keith Says:

    This is incredibly useful!

    Wow, thank you. Is there any way to activate mouse events? (I’m no coder, but finding my way through Xcode)

    I notice that audio and video works.

    Keith

  3. Keith Says:

    I’ll also add the note that the composition included in the build is lacking a Clear patch so sometimes cruft is left in the background of it. To fix it, you need to add a clear patch, then set the layer of the Clear patch to 1, otherwise you’ll see nothing.

    Keith

  4. vade Says:

    Hi Keith, ill check out passing the NSEvents to the QCRenderer, which should be pretty simple. As for the clear patch, interesting you need it, I dont, but I think that could be a hardware thing. I disabled some OpenGL code I thought might be unnecessary due to how it worked on my end, but ill add it back in for other folks. I think this is due to how multisampling works across vendors. Oh, graphics errata, :)

  5. Michael Says:

    Hi,

    This is really very interesting. I was wondering if there is a way to implement a similar idea in the Max/MSP/Jitter environment?
    I’m really interested in trying to change the transparency of a jit.window within the Max/MSP/Jitter environment.

    Michael

Leave a Reply