Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
fungus's avatar
fungus
Honored Guest
11 years ago

ovrHmd_GetRenderScaleAndOffset

Does anybody know what the second argument to "ovrHmd_GetRenderScaleAndOffset()" is?

(the one called "textureSize")

I've tried all sorts of values and the only thing I know for sure is that it isn't the size of the texture.

4 Replies

  • What did you give for the renderviewport parameter (third one)?
    The two are used together (texturesize is the resolution of the texture, renderviewport is the resolution and position of a viewport within the texturesize).
  • fungus's avatar
    fungus
    Honored Guest
    OK, I did this and it seems to work...


    ovrRecti vp;
    vp.Pos.x = vp.Pos.y = 0;
    vp.Size.w = texture->width();
    vp.Size.h = texture->height();
    ovrHmd_GetRenderScaleAndOffset(eye.Fov, vp.Size, vp, soff);


    The whole thing seems like an unnecessary layer of obfuscation to me though. Why can't ovrHmd_CreateDistortionMesh() just output texture coordinates from 0 to 1?

    I'm pretty sure I could supply a scale if I decided to use just a viewport inside a texture (and it would be much more obvious to everybody what it was needed and what scale to apply).
  • "fungus" wrote:
    The whole thing seems like an unnecessary layer of obfuscation to me though. Why can't ovrHmd_CreateDistortionMesh() just output texture coordinates from 0 to 1?

    The viewports on the texture may not fill the whole thing, ovrHmd_GetRenderScaleAndOffset lets you convert to a suitable range based on the size and position of the viewport. 0-1 is not always a suitable range.
  • fungus's avatar
    fungus
    Honored Guest
    "kojack" wrote:
    The viewports on the texture may not fill the whole thing, ovrHmd_GetRenderScaleAndOffset lets you convert to a suitable range based on the size and position of the viewport. 0-1 is not always a suitable range.


    I'm not saying it can't be made to work, I'm saying it's madness to do it that way.

    If it was 0-1 it would:
    a) Just Work for most people
    b) Be obvious to everybody else what the problem was (and how to fix it!)