captured texture from GL render to shared context on windows


    Jun 15 2011 | 1:18 am
    I am struggling to find a cross-platform solution for capturing a GL scene as a texture and use this in a shared context for preview purposes.
    Basically I am using the technique described by Wes Smith, using copy_texture and shared_context:
    This works fine on mac, but does not work when I try it in windows xp. If I go to fullscreen the preview doesn´t work anymore.
    The only example using shared_context that works in full screen on windows for me is the jitter recipe nr 39 by Andrew Benson, but his example captures individual GL objects, not the render output.
    So, is there a secret way of combining capturing GL render output to texture with shared_context that works in windows?

    • Jun 15 2011 | 12:06 pm
      I've tried your patch on Windows 7 64 bit (Max 5.1.8) and the same thing happens to me: whenever I go fullscreen it stops working. I've found that it's not only fullscreen, if you change the floating attribute the same thing happens. Even if you resize the main window (mix) it stops working.
      In order to be certain that the problem is not with fullscreen itself, I've changed your patch a little: I've put the main window to my 2nd monitor in fullscreen automatically using "jit.window mix @size 320 240 @pos 1930 10 @depthbuffer 1 @fullscreen 1" so it initializes that way and it's working fine.
      So I guess the problem is whenever the main window (or perhaps rendering context?) needs to re-initialize, the shared_context is lost.
    • Jun 15 2011 | 12:23 pm
      Hi,
      thanks for trying this out. I need to be able to switch fullscreen on and off.
      I guess what I am looking for is a consistent method on windows for re-initializing the rendering context.
      In my finished patch on mac osX I don´t need to do this when going fullscreen, but when I switch between floating and normal window I send the shared_context and copy_texture commands to my renderer, but this doesnt do anything on windows.
    • Jun 15 2011 | 3:55 pm
      I had issues with something similar back before Max 5, and my solution was to trick Jitter into rebuilding the context and its attached drawables by sending 'drawto xxxx' messages to the associated jit.gl.renderers. Id specify a named CPU matrix "dummy" or some such as a temporary destination, then change it back to the window, forcing a rebuild.
      Perhaps prior to going fullscreen, switch the rendering destination to a matrix for all of your targets, then switch it back once full screen. Same for when leaving full screen. Worth a shot. Also be sure to change the shared_context and copy_texture destinations, so things all update to logical destinations.
    • Jun 17 2011 | 12:27 pm
      I think I have tried every possible combination now, without success.
    • Jun 17 2011 | 11:37 pm
      Let´s hope to hear from Cycling if there's some sort of attribute missing, a correct order to initialize the objects, or any other workaround...