What do you need help with?

Stereoscopic 3D Rendering on the R-7

Follow

If you are developing an Application or SDK that does stereoscopic rendering, your code will have to put the R-7 Glasses displays into “extended” mode. This will allow applications to render different content on the left and right displays. The extended frame buffer has left and right displays side by side. The usual “cloned” 2D displays are copies, each 1280x720. The screen size of the R-7 in extended mode will be expanded to 2560x720.  

We provide a library: com.osterhoutgroup.api.ext.jar (extension library to change display surface from cloned to extended) that the developer adds as external jar file to their Application project.

API descriptions:

  • Add the following in AndroidManifest.xml:

<uses-library android:name="com.osterhoutgroup.api.ext" android:required="false" />

  • If you want the App to always be in extended mode, put this in AndroidManifest.xml:
     
        <meta-data
          android:name="com.osterhoutgroup.display_mode"
          android:value="extend" /> 
     
    Before <application> tag.
     
  • For setting a extended surface for the application window :

ExtendDisplay.extendWindow(getWindow(), true);

  • To get the display size of a window that is extended:

ExtendDisplay.getDisplayMetrics(Context context, Window window, DisplayMetrics outMetrics);

  • For setting a SurfaceView or any of its subclass as a extended surface:

ExtendDisplay.extendSurface(surface_view, true);

  • To get the display size if the SurfaceView is extended  

ExtendDisplay.getDisplayMetrics(Context context, SurfaceView surfaceView, DisplayMetrics outMetrics);

In the sample file ExtendActivity.java its onCreate method is calling two API for setting the display mode.

ExtendDisplay.extendWindow(getWindow(), extended);
ExtendDisplay.extendSurface(p, true);

 

Please note! In Marshmallow and up you have to extend the window first before extending the surface. This should be done in onCreateWe do it in onCreate to ensure the window surface  is extended. This is due to changes in Androids windowing system from KitKat to marshmallow. This shouldn't have a impact on suspend and resume since the window surface remains extended. 

 

If using reflection the method signature in Window.java is 

 
public void setOdgFlags(int flags, int mask) 
 
The flag is:
 
public static final int PRIVATE_FLAG_EXTEND_DISPLAY = 0x80000000;
 
window.setOdgFlags(WindowManager.LayoutParams.PRIVATE_FLAG_EXTEND_DISPLAY, WindowManager.LayoutParams.PRIVATE_FLAG_EXTEND_DISPLAY);
 

Attached to this article are theExternal jar com.osterhoutgroup.api.ext.jar as well as sample project in extendTest.zip that one of our developers uses for testing and shows native rendering rendering.  Also attached is a JavaDoc for the library.

 

This reference is to a book that covers concepts on rendering using OpenGL:

https://www.packtpub.com/books/content/rendering-stereoscopic-3d-models-using-opengl

 

Rendering in Unity:

If you were doing tracking with the camera, and Unity rendering with respect to the marker being tracked (using Vuforia or Wikitude), the tracking vendor usually supplies a Unity plug-in in their SDK. If you are not doing tracking and want to try Unity based rendering, see this article:

Sample-Unity-Plug-in

 

 

Have more questions? Submit a request

Comments

Powered by Zendesk