Gl render buffer question


    Apr 06 2006 | 1:03 am
    I'm looking for a way to enable drawing to several opengl buffers at
    once for writing into by a shader. The opengl command I want to
    execute is essentially glDrawBuffers(2, [GL_BACK_LEFT, GL_AUX0])
    jit.gl.sketch doesn't have a command for this. jit.gl.render has the
    @aux_buffers attribute for specifying an aux buffer. I'm not quite
    sure what this does, but it did completely screw up the way my sketch
    object is rendering vertices. And advice on how to do this will be
    greatly appreciated.
    thanks,
    wes

    • Apr 06 2006 | 1:12 am
      Aux buffers aren't well supported at the moment, Wes. Is there any
      way for you to accomplish what you are attempting by rending multiple
      times into the frame buffer?
      -Joshua
    • Apr 06 2006 | 1:24 am
      The fragment shader does the following in pass1
      gl_FragData[0] = texture2D(TextureMap, TexCoord);
      gl_FragData[1] = vec4(vec3(0.0), CameraDepth);
      In pass 2 it accesses both of these values to render shadows. So,
      somehow I need 2 buffers to write into simultaneously that I can then
      access in shader pass 2. If I did something like enable stereo
      rendering would I have access to 2 buffers then? Could I do something
      tricky like:
      jit.gl.render -> enable stereo
      run shader pass 1 and draw into left and right buffers
      run shader pass 2
      jit.gl.render -> disable stereo
      swap left buffer to screen
      This is wild speculation and probably won't work at all but gets the
      idea across. The first shader looks at objects' distance from the
      camera and renders the scene with no lighting information. The second
      pass add lighting and shadow information. This is from the Orange
      Book ch 13 p. 347
      It seems everytime I attempt to do some shadows in jitter I can't get
      anywhere because the method is not achievable the way things are
      currently set up. :(
      So, has anyone out there successfully rendered shadows in jitter? I'm
      very curious as no matter how I come at it, I can't seem to get there.
      thanks,
      wes
    • Apr 06 2006 | 1:37 am
      Randy made a patch back in March 05 and posted it to the list:
      here it is
      max v2;
    • Apr 06 2006 | 1:43 am
      Unfortunately, this approach also assumes that you can create a
      texture from the depth buffer of the aux buffer, which is also not
      exposed in Jitter. Randy a while back made a simple shadow map
      example, which I believe should be in the archives somewhere.
      The first pass of the technique outlined in the Orange Book can in
      theory be segmented into multiple stages each rendering to a single
      output texture which would then be used by a final stage, though
      currently it would be restricted to using the 8bit color channels of
      the output texture since there are issues with rendering to floating
      point textures at the moment. For greater precision with what's
      available, you could store the high order bits in one color channel
      and the low order bits in another color channel (this is similar to
      the approach I used for the hi-res MSP objects, making near double
      precision floats out of two single precision floats). So in theory
      what you want to accomplish is possible without aux buffers, depth
      textures, or rendering to floating point textures, though it would of
      course be cumbersome, and perhaps worth waiting until Jitter supports
      the functionality you need. Stereo buffers are also not exposed.
      We can work on aux buffer, stereo buffer, depth texture, and render
      to floating point texture support in a future version of Jitter, but
      for now, such tasks would require coding in a C object.
      -Joshua
    • Apr 06 2006 | 2:02 am
      Hey that's great! I don't remembr seeing this. The hedgehog thing is
      also nice. It's a nice start, but it is also really limited. The
      shadow isn't general enough to interact with the environment properly
      if I move the shadow plane up and down or change it's shape. So, for
      my next question...has anyone been able to do shadows using shaders in
      jitter? or depth testing methods?
      thanks,
      wes
    • Aug 25 2010 | 11:29 pm
      4 years ago, JKC wrote:
      > and perhaps worth waiting until Jitter supports
      > the functionality you need. Stereo buffers are also not exposed.
      >
      > We can work on aux buffer, stereo buffer, depth texture, and render
      > to floating point texture support in a future version of Jitter, but
      > for now, such tasks would require coding in a C object.
      So Joshua: did support for stereo buffers ever get added?
      Now that there are all these cheap 120Hz 3D projectors available, it would be really killer to be able to use them with Jitter.
      If not now, when?
      - pH
    • Aug 26 2010 | 6:08 pm
      We made some objects for doing active and passive stereo. It's a bit tricky to sequence the messaging, so we encapsulated it into a single object:
      Cosm: