diff options
author | Sven Gothel <[email protected]> | 2014-08-07 00:10:41 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-08-07 00:10:41 +0200 |
commit | 609b3f6d28bb13b589cde815acdb0e72e58ebe44 (patch) | |
tree | 355ee64c1cd5f49e17380f23e26854f06376a7e6 /src/oculusvr/classes | |
parent | 8be4b87a9740229f09b1dc2b7265e3e73c4397dd (diff) |
Bug 1021: Refine Stereo API; Fix GenericStereoDevice; Fix StereoDemo01 for movie playback and OSX usage (HiDPI surfaceSize)
- StereoDevice.DeviceType: Add API doc
- StereoDevice: Add getFactory()
- GenericStereoDevice
- Use common static vars for configurations for simplicity
- Fix createRenderer(..)'s eyeViewport in case no post-processing
is performed, i.e. needs viewport X offset.
- StereoDemo01
- Use 'movie' eyePosition instead of default if:
- using a movie player _and_ using lenses!
- Fix NEWT window pixel-unit size after window creation!
Diffstat (limited to 'src/oculusvr/classes')
-rw-r--r-- | src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java | 11 | ||||
-rw-r--r-- | src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java | 11 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java index 2832012e4..f6dc8bf9f 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java @@ -41,6 +41,7 @@ import com.jogamp.oculusvr.ovrHmdDesc; import com.jogamp.oculusvr.ovrSizei; import com.jogamp.opengl.math.FovHVHalves; import com.jogamp.opengl.util.stereo.StereoDevice; +import com.jogamp.opengl.util.stereo.StereoDeviceFactory; import com.jogamp.opengl.util.stereo.StereoDeviceRenderer; import com.jogamp.opengl.util.stereo.StereoUtil; @@ -48,6 +49,7 @@ public class OVRStereoDevice implements StereoDevice { /** 1.6 up, 5 forward */ private static final float[] DEFAULT_EYE_POSITION_OFFSET = { 0.0f, 1.6f, -5.0f }; + private final StereoDeviceFactory factory; public final OvrHmdContext handle; public final int deviceIndex; public final ovrHmdDesc hmdDesc; @@ -57,7 +59,11 @@ public class OVRStereoDevice implements StereoDevice { private final int[] eyeRenderOrder; private final int supportedDistortionBits, recommendedDistortionBits, minimumDistortionBits; - public OVRStereoDevice(final OvrHmdContext nativeContext, final int deviceIndex) { + public OVRStereoDevice(final StereoDeviceFactory factory, final OvrHmdContext nativeContext, final int deviceIndex) { + if( null == nativeContext ) { + throw new IllegalArgumentException("Passed null nativeContext"); + } + this.factory = factory; this.handle = nativeContext; this.deviceIndex = deviceIndex; this.hmdDesc = ovrHmdDesc.create(); @@ -75,6 +81,9 @@ public class OVRStereoDevice implements StereoDevice { } @Override + public final StereoDeviceFactory getFactory() { return factory; } + + @Override public final String toString() { final StringBuilder sb = new StringBuilder(); sb.append("OVRStereoDevice[product "+hmdDesc.getProductNameAsString()); diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java index b292c882d..06f716ddc 100644 --- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java +++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java @@ -44,9 +44,16 @@ public class OVRStereoDeviceFactory extends StereoDeviceFactory { } @Override - public final StereoDevice createDevice(final int deviceIndex, Config config, final boolean verbose) { + public final StereoDevice createDevice(final int deviceIndex, final Config config, final boolean verbose) { final OvrHmdContext hmdCtx = OVR.ovrHmd_Create(deviceIndex); - final OVRStereoDevice ctx = new OVRStereoDevice(hmdCtx, deviceIndex); + if( null == hmdCtx ) { + if( verbose ) { + System.err.println("Failed to create hmdCtx for device index "+deviceIndex+" on thread "+Thread.currentThread().getName()); + Thread.dumpStack(); + } + return null; + } + final OVRStereoDevice ctx = new OVRStereoDevice(this, hmdCtx, deviceIndex); if( verbose ) { System.err.println(OVRVersion.getAvailableCapabilitiesInfo(ctx.hmdDesc, deviceIndex, null).toString()); } |