gl.render offset(offaxis) message? Perspective correction...


    Dec 21 2006 | 6:10 am
    What is the message and way to use it for renderind an offset (offaxis) gl view? (camera is not moving!!!)
    after web search I thought perhaps it's : glTranslated. I also remenber (years ago that gl had such function)
    I'll use it to simulate the offaxis projection viewpoint of video beamer. Generally 50/70% down the central vertical axis.
    Example:I use a 1024x1536 window of a render context, and display only the half upper part to simulate a video beamer(w. 50% offset).
    It would be better if i could work with a 1024x768 window of an offsetted render
    thanks
    Spat

    • Dec 21 2006 | 6:16 am
      sorry for double post....
    • Dec 21 2006 | 6:16 am
      Have you tried jit.gl.render @camera for positioning the camera?
      wes
      On 12/20/06, patrice wrote:
      >
      > What is the message and way to use it for renderind an offset (offaxis) gl view? (camera is not moving!!!)
      > after web search I thought perhaps it's : glTranslated. I also remenber (years ago that gl had such function)
      >
      > I'll use it to simulate the offaxis projection viewpoint of video beamer. Generally 50/70% down the central vertical axis.
      >
      > Example:I use a 1024x1536 window of a render context, and display only the half upper part to simulate a video beamer(w. 50% offset).
      > It would be better if i could work with a 1024x768 window of an offsetted render
      >
      > thanks
      >
      > Spat
      >
    • Dec 21 2006 | 6:22 am
      Hey wes,
      I'm not talking about moving the camera but of 'cutting' a part of the gl render. (offaxis render).
      The perspective view point stay the same.
      So that an 1024x768 window with 50% offaxis render will display exactly the same view than the upper part of a 1024x1536 window..
      I don't know if it's clear
      It's also called perspective correction
      thanks
    • Dec 21 2006 | 6:49 am
      After a bit more search it seems that the function is glFrustum().
      Is it possible to access it through jitter, how?
      source: Silicongraphics
      The OpenGL glFrustum() function can be altered to do an asymmetric frustum projection. Here's how: glFrustum (FrustumLeft + FrustumAsymmetry, FrustumRight
      + FrustumAsymmetry, FrustumBottom, FrustumTop,
      NearClipDistance, FarClipDistance);
    • Dec 21 2006 | 7:21 am
      I don't know why you keep calling it offaxis render. I've never heard
      this term used before. You can access most of the OpenGL commands via
      jit.gl.sketch. To have it take effect for your scene, you can use it
      in immediate mode or draw everything in your scene with jit.gl.sketch
      through the drawobject message after you set glfrustum.
      wes
      On 12/20/06, patrice wrote:
      >
      > Hey wes,
      > I'm not talking about moving the camera but of 'cutting' a part of the gl render. (offaxis render).
      > The perspective view point stay the same.
      > So that an 1024x768 window with 50% offaxis render will display exactly the same view than the upper part of a 1024x1536 window..
      >
      > I don't know if it's clear
      >
      > It's also called perspective correction
      > thanks
      >
    • Dec 22 2006 | 4:32 pm
      Quote: wesley.hoke@gmail.com wrote on Thu, 21 December 2006 08:21
      ----------------------------------------------------
      > I don't know why you keep calling it offaxis render. I've never heard
      > this term used before.
      Me neither, but for me it's clear what you're after. In fact I would definitly like to see this working (I didn't try yet), because this would make it possible to render one scene on multiple windows without the perspective problem. See also the discussion on
      Mattijs
    • Dec 22 2006 | 5:50 pm
      Here's a demo patch that shows how to do asymmetric projections with
      glfrustum. And the JS that you'll need
      wes
      ------------------CalcFrustum.js
      autowatch = 1
      var sketch = new JitterObject("jit.gl.sketch", "half");
      sketch.automatic = 0;
      function calc_frustum()
      {
      var projection = sketch.glget("projection_matrix")
      var clipRatio = (projection[10] - 1.)/(1. + projection[10]);
      //near + far calculations
      var near = projection[14]*(1-clipRatio)/(2.*clipRatio);
      var far = clipRatio * near;
      //left + right calculations
      var left = -near*(1. - projection[8])/projection[0];
      var right = 2*near/projection[0] + left;
      //bottom + top calculations
      var bottom = -near*(1. - projection[9])/projection[5];
      var top = 2*near/projection[5] + bottom;
      post("nStandard glFrustum params based on jit.gl.render settings:n")
      post("glFrustum( " + left.toPrecision(3) + ", " +
      right.toPrecision(3) + ", " +
      bottom.toPrecision(3) + ", " + top.toPrecision(3) + ", " +
      near.toPrecision(3) + ", " + far.toPrecision(3) + " )n")
      }
    • Dec 23 2006 | 5:09 pm
      thanks a lot for the patch and js.
      It's clearly not straightforward.
      It seems that those opengl commands are accessible only through jit.gl.sketch.
      Or, is there a way to pass them to a render? (in a typical videoplane>render chain)
      thanks again
      spat
    • Dec 23 2006 | 5:18 pm
      Most of the OpenGL API is only available via jit.gl.sketch. If you
      want your 3D stuff to be affected by the glFrustum commands, you'll
      have to render them in sketch as well with the drawobject message.
      wes
      On 12/23/06, patrice wrote:
      >
      > thanks a lot for the patch and js.
      > It's clearly not straightforward.
      >
      > It seems that those opengl commands are accessible only through jit.gl.sketch.
      > Or, is there a way to pass them to a render? (in a typical videoplane>render chain)
      >
      > thanks again
      > spat
      >