[openFrameworks] How to access client as texture instead of just a draw?

Home Forums Syphon Syphon Implementations – User [openFrameworks] How to access client as texture instead of just a draw?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18056
    laserpilot
    Participant

    I’m working on making some syphon openCV widgets for VDMX in OF but I hit an early roadblock on getting access to the texture coming in from syphon. It’s protected, so I’ll either need to make another function on ofxSyphon that returns a copy of the texture or do something much less efficient.

    Another silly way is: I could use the bind/unbind calls to bind the texture to an FBO and then use that as my texture, but that just sounds like a terrible idea when I have the texture sitting right there.

    There are a bunch of ways I could do it, but I feel like I might be missing something simple and it’s a difficult thing to search for.

    #18099
    laserpilot
    Participant

    edit: nevermind (i think)…found got some answers on the OF forum once i found the right thread. Not possible at the moment due to potential threading issues (at least it wasn’t a year ago)…ultimately i was looking to use it with opencv: http://forum.openframeworks.cc/index.php/topic,7791.0.html

    #18100
    bangnoise
    Keymaster

    There’s no reason you can’t expose the texture as a texture if that’s of any help and you want to modify ofxSyphon to allow it (ofxSyphon would love the attention). Just be aware that the texture is dependent on the lifetime of the Objective C SyphonImage object, so don’t release it while it might still be in use by OF.

    As OpenCV needs pixel-buffers from it you will have to copy it via an FBO to get those – for the reasons discussed in that thread. Holler if we can give you any pointers – sounds like you’re on your way though.

    #18288
    laserpilot
    Participant

    Thanks Tom!

    I got the FBO setup working ( https://vimeo.com/59377121 )

    and it seems to run pretty well despite being such an unintended use.

    The one tricky bit I’m running into is how to sync my frame updates with open cv. Usually the Open CV updates in OF are only updated when there is a new frame from the videograbber, but with ofxSyphon I don’t seem have access to this kind of information.

    Is there an easy way to get the frame update information from Syphon into ofxSyphon so I can try and limit frame drops? What parts should I take a look at?

    #18289
    bangnoise
    Keymaster

    Yo and cool –

    SyphonClient has a hasNewFrame method which you could extend ofxSyphon to expose, then only do work when that returns YES.

    This will be of some but limited use if the server is running in VDMX, as VDMX has little to no notion of throttling things down when it can.

    #18320
    bangnoise
    Keymaster

    Further re VDMX, Ray has just reminded me that you can limit the render rate (soz if you already know this)

    – VDMX5 > Preferences… > Rendering
    – Scroll down to reveal the hidden Advanced Rendering Prefs button and hit it
    – Uncheck Display Drives Canvas Rendering
    – Alongside its dimensions, your Canvas/Main Output will now have a FPS setting – set that to whatever seems reasonable – probably the rate of your original video source

    It’s not going to give you true sync, but coupled with only rendering in OF on new frames it should improve things quite a bit

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.