com.google.vr.ndk.base.GvrLayout Java Examples
The following examples show how to use
com.google.vr.ndk.base.GvrLayout.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NonPresentingGvrContextImpl.java From 365browser with Apache License 2.0 | 5 votes |
public NonPresentingGvrContextImpl(Activity activity) { // Creating the GvrLayout can sometimes create the Daydream config file. StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites(); try { mGvrLayout = new GvrLayout(activity); } finally { StrictMode.setThreadPolicy(oldPolicy); } }
Example #2
Source File: MainActivity.java From PanoramaGL with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setImmersiveSticky(); getWindow() .getDecorView() .setOnSystemUiVisibilityChangeListener( new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { setImmersiveSticky(); } } }); // Enable VR mode, if the device supports it. AndroidCompat.setVrModeEnabled(this, true); // Get the GvrLayout. gvrLayout = new GvrLayout(this); // Enable scan line racing, if possible. if (gvrLayout.setAsyncReprojectionEnabled(true)) { Log.d(TAG, "Successfully enabled scanline racing."); // Scanline racing decouples the app framerate from the display framerate, // allowing immersive interaction even at the throttled clockrates set by // sustained performance mode. AndroidCompat.setSustainedPerformanceMode(this, true); } else { Log.w(TAG, "Failed to enable scanline racing."); } // Configure the GLSurfaceView. surfaceView = new GLSurfaceView(this); surfaceView.setEGLContextClientVersion(2); surfaceView.setEGLConfigChooser(8, 8, 8, 0, 0, 0); surfaceView.setPreserveEGLContextOnPause(true); surfaceView.setRenderer(renderer); // Set the GLSurfaceView as the GvrLayout's presentation view. gvrLayout.setPresentationView(surfaceView); // Enable and configure the back button in the UI layout. gvrLayout .getUiLayout() .setBackButtonListener( new Runnable() { @Override public void run() { onBackPressed(); } }); // Add the GvrLayout to the View hierarchy. setContentView(gvrLayout); assetManager = getResources().getAssets(); nativeOnCreate(assetManager, gvrLayout.getGvrApi().getNativeGvrContext()); // Prevent screen from dimming/locking. getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
Example #3
Source File: NonPresentingGvrContextImpl.java From AndroidChromium with Apache License 2.0 | 4 votes |
@UsedByReflection("VrShellDelegate.java") public NonPresentingGvrContextImpl(Activity activity) { mGvrLayout = new GvrLayout(activity); }