Forum Discussion

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

What is the motivation for ovrEye_Count?

Is it for rendering to a standard screen ("one eye")? Or is it something involving possibly more than two eyes?

2 Replies

  • Jose's avatar
    Jose
    Heroic Explorer
    I'm guessing it's possibly there for accessibility reasons. There are some people with only one functioning eye, and they will want to use VR also. It might also be useful to know the number of eyes, so that if there is only one then stereo rendering can be disabled which will free up some gpu performance.
  • "wwwtyro" wrote:
    Is it for rendering to a standard screen ("one eye")? Or is it something involving possibly more than two eyes?


    It's a common C idiom to have the final member of an enum be a 'count' value. This means if you want to iterate over all the values in the enum you can do this


    for (int i = 0; i < ovrEye_Count; ++i) {
    // do stuff
    }


    This means that the code would continue to work, even if additional values were added to the enum, because the 'count' value would increase. For instance in ovrRenderAPIType, where there is a ovrRenderAPI_Count value at the end. It's quite likely that the SDK might support additional rendering back-ends in the future, perhaps breaking up the OpenGL into an OpenGL 3.x and an OpenGL 4.x renderer, or to support an iOS GL renderer.

    Granted, it's unlikely in the case of eyes for that value to ever change, but it's simpler and less confusing to follow the convention everywhere once you have it, than to make exceptions simply because people aren't ever likely to have more than 2 eyes.