Skip to main content
Participant
August 17, 2014

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

    kojack
    Honored Contributor
    August 17, 2014
    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).
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    fungusAuthor
    Participant
    August 18, 2014
    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).
    kojack
    Honored Contributor
    August 18, 2014
    "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.
    Author: Oculus Monitor , Auto Oculus Touch , Forum Dark Mode , Phantom Touch Remover , X-Plane Fixer Hardware: Threadripper 1950x, MSI Gaming Trio 2080TI, Asrock X399 Taich Headsets: Wrap 1200VR, DK1, DK2, CV1, Rift-S, GearVR, Go, Quest, Quest 2, Reverb G2, Quest 3
    fungusAuthor
    Participant
    August 18, 2014
    "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!)