From 32fc8f3a64cfeee8936af98ae49f8e7c8dfe982f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 21 Mar 2015 04:31:27 +0100 Subject: Bug 1116 - Add OculusVR DK2 Support - Part-1 (DK2 on DK1 SDK w/o Eye Tracker) - DK2's screen on X11 (at least) starts in rotated mode, detect and apply MonitorDevice rotation via NEWT's OpenGL StereoDeviceUtil - Move StereoDevice.Config -> StereoDeviceConfig - Expose generic StereoDevice to public: GenericStereoDeviceConfig + GenericStereoDeviceFactory - GenericStereoDeviceFactory exposes public GenericStereoDeviceConfig creation for mono, sbs-stereo and lense-sbs-stereo w/ diff. parameters. - Pass eye surface/texture size for each eye from device to renderer, instead of assuming unified values. - Unify GenericStereoDevice.createRenderer(..) and OVRStereoDevice.createRenderer(..) code --- .../opengl/test/junit/jogl/stereo/StereoDemo01.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java index 4f8fb3bd2..39ca85527 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java @@ -40,9 +40,12 @@ import com.jogamp.opengl.GLProfile; import jogamp.opengl.util.stereo.GenericStereoDevice; import com.jogamp.common.net.Uri; +import com.jogamp.newt.MonitorDevice; +import com.jogamp.newt.Screen; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.newt.opengl.util.stereo.StereoDeviceUtil; import com.jogamp.opengl.math.FovHVHalves; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSBSStereo; @@ -249,15 +252,21 @@ public class StereoDemo01 { // // // - final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxProgrammable(true /* favorHardwareRasterizer */)); - final GLWindow window = GLWindow.create(caps); - final PointImmutable devicePos = stereoDevice.getPosition(); final DimensionImmutable deviceRes = stereoDevice.getSurfaceSize(); + System.err.println("Device Res "+deviceRes+", reqRotation "+stereoDevice.getRequiredRotation()); + System.err.println("Device Pos "+devicePos); + + final MonitorDevice monitor = StereoDeviceUtil.getMonitorDevice(stereoDevice, true); + final Screen screen = monitor.getScreen(); + + final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxProgrammable(true /* favorHardwareRasterizer */)); + final GLWindow window = GLWindow.create(screen, caps); + if( useStereoScreen ) { window.setPosition(devicePos.getX(), devicePos.getY()); } - window.setSurfaceSize(deviceRes.getWidth(), deviceRes.getHeight()); // might be not correct .. + window.setSurfaceSize(deviceRes.getWidth(), deviceRes.getHeight()); window.setAutoSwapBufferMode(useAutoSwap); window.setUndecorated(true); @@ -361,6 +370,7 @@ public class StereoDemo01 { animator.stop(); } window.destroy(); + screen.removeReference(); // StereoDeviceUtil.getMonitorDevice(stereoDevice, true); stereoDevice.dispose(); } } -- cgit v1.2.3