JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
StereoDemo01.java
Go to the documentation of this file.
1/**
2 * Copyright 2014 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.demos.av;
29
30import java.io.File;
31import java.net.URISyntaxException;
32import java.util.Arrays;
33
34import com.jogamp.nativewindow.util.DimensionImmutable;
35import com.jogamp.nativewindow.util.PointImmutable;
36import com.jogamp.opengl.GL;
37import com.jogamp.opengl.GLAutoDrawable;
38import com.jogamp.opengl.GLCapabilities;
39import com.jogamp.opengl.GLProfile;
40import com.jogamp.opengl.GLRunnable;
41import com.jogamp.opengl.demos.es2.GearsES2;
42import com.jogamp.opengl.demos.util.MiscUtils;
43import com.jogamp.opengl.demos.util.QuitAdapter;
44
45import jogamp.opengl.util.stereo.GenericStereoDevice;
46
47import com.jogamp.common.net.Uri;
48import com.jogamp.math.FovHVHalves;
49import com.jogamp.math.Vec3f;
50import com.jogamp.newt.MonitorDevice;
51import com.jogamp.newt.Screen;
52import com.jogamp.newt.event.KeyAdapter;
53import com.jogamp.newt.event.KeyEvent;
54import com.jogamp.newt.opengl.GLWindow;
55import com.jogamp.newt.opengl.util.stereo.StereoDeviceUtil;
56import com.jogamp.opengl.util.Animator;
57import com.jogamp.opengl.util.AnimatorBase;
58import com.jogamp.opengl.util.av.GLMediaPlayer;
59import com.jogamp.opengl.util.stereo.StereoDevice;
60import com.jogamp.opengl.util.stereo.StereoDeviceRenderer;
61import com.jogamp.opengl.util.stereo.StereoDeviceFactory;
62import com.jogamp.opengl.util.stereo.StereoClientRenderer;
63import com.jogamp.opengl.util.stereo.StereoGLEventListener;
64import com.jogamp.opengl.util.stereo.StereoUtil;
65
66/**
67 * All distortions, no multisampling, bilinear filtering, manual-swap and using two FBOs (default, good)
68 * <pre>
69 * java StereoDemo01 -time 10000000
70 * </pre>
71 * All distortions, 8x multisampling, bilinear filtering, manual-swap and using two FBOs (best - slowest)
72 * <pre>
73 * java StereoDemo01 -time 10000000 -samples 8
74 * </pre>
75 * All distortions, 8x multisampling, bilinear filtering, manual-swap and using one a big single FBO (w/ all commandline params)
76 * <pre>
77 * java StereoDemo01 -time 10000000 -vignette true -chromatic true -timewarp false -samples 8 -biLinear true -autoSwap false -singleFBO true -mainScreen false
78 * </pre>
79 * No distortions, no multisampling, no filtering, auto-swap and using a big single FBO (worst and fastest)
80 * <pre>
81 * java StereoDemo01 -time 10000000 -vignette false -chromatic false -timewarp false -samples 0 -biLinear false -autoSwap true -singleFBO true
82 * </pre>
83 * Test on main screen:
84 * <pre>
85 * java StereoDemo01 -time 10000000 -mainScreen true
86 * </pre>
87 * Test a 3D SBS Movie:
88 * <pre>
89 * java StereoDemo01 -time 10000000 -filmFile Some_SBS_3D_Movie.mkv
90 * java StereoDemo01 -time 10000000 -filmURI http://whoknows.not/Some_SBS_3D_Movie.mkv
91 * </pre>
92 * <p>
93 * In case user likes to utilize the {@link StereoDeviceFactory.DeviceType#Generic Generic} software implementation,
94 * which is selected {@link StereoDeviceFactory.DeviceType#Default Default} if no other device is available
95 * or explicit via <code>-device Generic</code>, the user can chose between different <i>generic</i> stereo modes:
96 * <pre>
97 * mono : <code>-device Generic -deviceIndex 0</code>
98 * stereo-sbs : <code>-device Generic -deviceIndex 1</code>
99 * stereo-sbs-lense: <code>-device Generic -deviceIndex 2</code>
100 * </pre>
101 * </p>
102 * <p>
103 * Key 'R' enables/disables the VR's sensors, i.e. head rotation ..
104 * </p>
105 *
106 */
107public class StereoDemo01 {
108 static long duration = 10000; // ms
109
110 static boolean useStereoScreen = true;
111
112 static int numSamples = 0;
113 static boolean biLinear = true;
114 static boolean useSingleFBO = false;
115 static boolean useVignette = true;
116 static boolean useChromatic = true;
117 static boolean useTimewarp = true;
118 static boolean useAutoSwap = false;
119 static String useFilmFile = null;
120 static String useFilmURI = null;
121 static StereoDeviceFactory.DeviceType deviceType = StereoDeviceFactory.DeviceType.Default;
122 static int deviceIndex = 0;
123
124 public static void main(final String args[]) throws InterruptedException, URISyntaxException {
125 boolean useRecommendedDistortionBits = true;
126 int posx = -1;
127 int posy = -1;
128
129 for(int i=0; i<args.length; i++) {
130 if(args[i].equals("-time")) {
131 i++;
132 duration = MiscUtils.atol(args[i], duration);
133 } else if(args[i].equals("-samples")) {
134 i++;
135 numSamples = MiscUtils.atoi(args[i], numSamples);
136 } else if(args[i].equals("-biLinear")) {
137 i++;
138 biLinear = MiscUtils.atob(args[i], biLinear);
139 } else if(args[i].equals("-singleFBO")) {
140 i++;
141 useSingleFBO = MiscUtils.atob(args[i], useSingleFBO);
142 } else if(args[i].equals("-vignette")) {
143 i++;
144 useVignette = MiscUtils.atob(args[i], useVignette);
145 useRecommendedDistortionBits = false;
146 } else if(args[i].equals("-chromatic")) {
147 i++;
148 useChromatic = MiscUtils.atob(args[i], useChromatic);
149 useRecommendedDistortionBits = false;
150 } else if(args[i].equals("-timewarp")) {
151 i++;
152 useTimewarp = MiscUtils.atob(args[i], useTimewarp);
153 useRecommendedDistortionBits = false;
154 } else if(args[i].equals("-vignette")) {
155 i++;
156 useVignette = MiscUtils.atob(args[i], useVignette);
157 useRecommendedDistortionBits = false;
158 } else if(args[i].equals("-mainScreen")) {
159 i++;
160 useStereoScreen = !MiscUtils.atob(args[i], useStereoScreen);
161 } else if(args[i].equals("-device")) {
162 i++;
163 deviceType = StereoDeviceFactory.DeviceType.valueOf(args[i]);
164 } else if(args[i].equals("-deviceIndex")) {
165 i++;
166 deviceIndex = MiscUtils.atoi(args[i], deviceIndex);
167 } else if(args[i].equals("-posx")) {
168 i++;
169 posx = MiscUtils.atoi(args[i], posx);
170 } else if(args[i].equals("-posy")) {
171 i++;
172 posy = MiscUtils.atoi(args[i], posy);
173 } else if(args[i].equals("-autoSwap")) {
174 i++;
175 useAutoSwap = MiscUtils.atob(args[i], useAutoSwap);
176 } else if(args[i].equals("-filmFile")) {
177 i++;
178 useFilmFile = args[i];
179 } else if(args[i].equals("-filmURI")) {
180 i++;
181 useFilmURI = args[i];
182 }
183 }
184 final StereoGLEventListener upstream;
185 final MovieSBSStereo movieSimple;
186 final Uri movieURI;
187 if( null != useFilmFile ) {
188 movieSimple = new MovieSBSStereo();
189 movieURI = Uri.valueOf(new File(useFilmFile));
190 upstream = movieSimple;
191 } else if( null != useFilmURI ) {
192 movieSimple = new MovieSBSStereo();
193 movieURI = Uri.cast(useFilmURI);
194 upstream = movieSimple;
195 } else {
196 final GearsES2 demo = new GearsES2(0);
197 demo.setZ(2f, 10000f, 20f); // start closer to eye
198 demo.setVerbose(false);
199 upstream = demo;
200 movieSimple = null;
201 movieURI = null;
202 }
203 final StereoDemo01 demo01 = new StereoDemo01();
204 demo01.doIt(deviceType, deviceIndex, posx, posy,
205 upstream, movieSimple, movieURI, biLinear, numSamples, useSingleFBO,
206 useRecommendedDistortionBits, useVignette, useChromatic, useTimewarp,
207 useAutoSwap, true /* useAnimator */, false /* exclusiveContext*/);
208 }
209
210 public void doIt(final StereoDeviceFactory.DeviceType deviceType, final int deviceIndex, final int posx, final int posy,
211 final StereoGLEventListener upstream, final MovieSBSStereo movieSimple, final Uri movieURI,
212 final boolean biLinear, final int numSamples, final boolean useSingleFBO,
213 final boolean useRecommendedDistortionBits, final boolean useVignette, final boolean useChromatic, final boolean useTimewarp,
214 final boolean useAutoSwap, final boolean useAnimator, final boolean exclusiveContext) throws InterruptedException {
215
216 System.err.println("glob duration "+duration);
217 System.err.println("glob useStereoScreen "+useStereoScreen);
218 System.err.println("deviceType "+deviceType);
219 System.err.println("deviceIndex "+deviceIndex);
220 System.err.println("biLinear "+biLinear);
221 System.err.println("numSamples "+numSamples);
222 System.err.println("useSingleFBO "+useSingleFBO);
223 System.err.println("useRecommendedDistortionBits "+useRecommendedDistortionBits);
224 System.err.println("useVignette "+useVignette);
225 System.err.println("useChromatic "+useChromatic);
226 System.err.println("useTimewarp "+useTimewarp);
227 System.err.println("useAutoSwap "+useAutoSwap);
228
229 final StereoDeviceFactory stereoDeviceFactory = StereoDeviceFactory.createFactory(deviceType);
230 if( null == stereoDeviceFactory ) {
231 System.err.println("No StereoDeviceFactory available");
232 return;
233 }
234
235 final StereoDevice stereoDevice = stereoDeviceFactory.createDevice(deviceIndex, null, true /* verbose */);
236 if( null == stereoDevice ) {
237 System.err.println("No StereoDevice.Context available for index "+deviceIndex);
238 return;
239 }
240
241 final boolean isGenericDevice = stereoDevice instanceof GenericStereoDevice;
242
243 if( 0 <= posx && 0 <= posy && isGenericDevice ) {
244 ((GenericStereoDevice)stereoDevice).setSurfacePosition(posx, posy);
245 }
246 System.err.println("StereoDevice "+stereoDevice);
247
248 //
249 //
250 //
251 final PointImmutable devicePos = stereoDevice.getPosition();
252 final DimensionImmutable deviceRes = stereoDevice.getSurfaceSize();
253 System.err.println("Device Res "+deviceRes+", reqRotation "+stereoDevice.getRequiredRotation());
254 System.err.println("Device Pos "+devicePos);
255
256 final MonitorDevice monitor = StereoDeviceUtil.getMonitorDevice(stereoDevice, true);
257 final Screen screen = monitor.getScreen();
258
259 // Start the sensor which provides the Rift’s pose and motion.
260 if( !stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0) ) {
261 System.err.println("Could not start sensors on device "+deviceIndex);
262 }
263
264 final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxProgrammable(true /* favorHardwareRasterizer */));
265 final GLWindow window = GLWindow.create(screen, caps);
266
267 if( useStereoScreen ) {
268 window.setPosition(devicePos.getX(), devicePos.getY());
269 }
270 window.setSurfaceSize(deviceRes.getWidth(), deviceRes.getHeight());
271 window.setAutoSwapBufferMode(useAutoSwap);
272 window.setUndecorated(true);
273
274 final Animator animator = useAnimator ? new Animator(0 /* w/o AWT */) : null;
275 if( useAnimator ) {
276 animator.setExclusiveContext(exclusiveContext);
277 }
278
279 //
280 // Stereo Device Setup
281 //
282 // EyePos.y = ovrHmd_GetFloat(HMD, OVR_KEY_EYE_HEIGHT, EyePos.y);
283 final FovHVHalves[] defaultEyeFov = stereoDevice.getDefaultFOV();
284 System.err.println("Default Fov[0]: "+defaultEyeFov[0]);
285 System.err.println("Default Fov[0]: "+defaultEyeFov[0].toStringInDegrees());
286 if( defaultEyeFov.length > 1 ) {
287 System.err.println("Default Fov[1]: "+defaultEyeFov[1]);
288 System.err.println("Default Fov[1]: "+defaultEyeFov[1].toStringInDegrees());
289 }
290
291 final boolean usesLenses = 0 != ( StereoDeviceRenderer.DISTORTION_BARREL & stereoDevice.getMinimumDistortionBits() );
292 final Vec3f eyePositionOffset = null != movieSimple && usesLenses ? new Vec3f( 0f, 0.3f, 0f ) // better fixed movie position w/ lenses
293 : stereoDevice.getDefaultEyePositionOffset(); // default
294 System.err.println("Eye Position Offset: "+eyePositionOffset);
295
296 final int textureUnit = 0;
297 final int reqDistortionBits;
298 if( useRecommendedDistortionBits ) {
299 reqDistortionBits = stereoDevice.getRecommendedDistortionBits();
300 } else {
301 reqDistortionBits = ( useVignette ? StereoDeviceRenderer.DISTORTION_VIGNETTE : 0 ) |
302 ( useChromatic ? StereoDeviceRenderer.DISTORTION_CHROMATIC : 0 ) |
303 ( useTimewarp ? StereoDeviceRenderer.DISTORTION_TIMEWARP : 0 );
304 }
305 System.err.println("Requesting Distortion Bits: "+StereoUtil.distortionBitsToString(reqDistortionBits));
306
307 final float pixelsPerDisplayPixel = 1f;
308 final StereoDeviceRenderer stereoDeviceRenderer =
309 stereoDevice.createRenderer(reqDistortionBits, useSingleFBO ? 1 : 2, eyePositionOffset,
310 defaultEyeFov, pixelsPerDisplayPixel, textureUnit);
311 System.err.println("StereoDeviceRenderer: "+stereoDeviceRenderer);
312
313 final int texFilter = biLinear ? GL.GL_LINEAR : GL.GL_NEAREST;
314 final StereoClientRenderer renderer = new StereoClientRenderer(stereoDeviceRenderer, true /* ownsDist */, texFilter, texFilter, numSamples);
315 if( null != movieSimple && null != movieURI) {
316 movieSimple.setScaleOrig(true);
317 final GLMediaPlayer mp = movieSimple.getGLMediaPlayer();
321 movieSimple.initStream(movieURI, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 3);
322 } else {
323 renderer.addGLEventListener(upstream);
324 }
325 window.addGLEventListener(renderer);
326
327 final QuitAdapter quitAdapter = new QuitAdapter();
328 window.addKeyListener(quitAdapter);
329 window.addWindowListener(quitAdapter);
330
331 window.addKeyListener(new KeyAdapter() {
332 @Override
333 public void keyReleased(final KeyEvent e) {
334 if( e.isAutoRepeat() ) {
335 return;
336 }
337 switch(e.getKeySymbol()) {
338 case KeyEvent.VK_O: {
339 window.invoke(false, new GLRunnable() {
340 @Override
341 public boolean run(final GLAutoDrawable drawable) {
342 stereoDevice.resetLocationSensorOrigin();
343 return true;
344 } });
345 break;
346 }
347 case KeyEvent.VK_P: {
348 window.invoke(false, new GLRunnable() {
349 @Override
350 public boolean run(final GLAutoDrawable drawable) {
351 System.err.println(stereoDeviceRenderer.getLastViewerPose());
352 return true;
353 } });
354 break;
355 }
356 case KeyEvent.VK_R: {
357 if( stereoDevice.getSensorsStarted() ) {
358 stereoDevice.stopSensors();
359 } else {
360 stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0);
361 }
362 break;
363 }
364 }
365 } } );
366
367 if( useAnimator ) {
368 animator.add(window);
369 animator.start();
370 }
371 window.setVisible(true);
372
373 // Correct window size to actual pixel size,
374 // which ration is unknown before window creation when using multiple displays!
375 System.err.println("Window.0.windowSize : "+window.getWidth()+" x "+window.getHeight());
376 System.err.println("Window.0.surfaceSize: "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
377 window.setSurfaceSize(deviceRes.getWidth(), deviceRes.getHeight());
378 if( useStereoScreen ) {
379 window.setPosition(devicePos.getX(), devicePos.getY());
380 }
381 System.err.println("Window.1.windowSize : "+window.getWidth()+" x "+window.getHeight());
382 System.err.println("Window.1.surfaceSize: "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
383
384 if( useAnimator ) {
385 animator.setUpdateFPSFrames(60*10, System.err);
386 }
387
388 final long t0 = System.currentTimeMillis();
389 long t1 = t0;
390 while(!quitAdapter.shouldQuit() && t1-t0<duration) {
391 Thread.sleep(100);
392 t1 = System.currentTimeMillis();
393 }
394
395 if( useAnimator ) {
396 animator.stop();
397 }
398 window.destroy();
399 screen.removeReference(); // StereoDeviceUtil.getMonitorDevice(stereoDevice, true);
400 stereoDevice.dispose();
401 stereoDeviceFactory.shutdown();
402 }
403}
Horizontal and vertical field of view (FOV) halves, allowing a non-centered projection.
3D Vector based upon three float components.
Definition: Vec3f.java:37
Visual output device, i.e.
final Screen getScreen()
Returns the Screen owning this monitor.
A screen may span multiple MonitorDevices representing their combined virtual size.
Definition: Screen.java:58
abstract int removeReference()
See Display#removeReference().
final boolean isAutoRepeat()
getModifiers() contains AUTOREPEAT_MASK.
final short getKeySymbol()
Returns the virtual key symbol reflecting the current keyboard layout.
Definition: KeyEvent.java:176
static final short VK_P
See VK_A.
Definition: KeyEvent.java:625
static final short VK_R
See VK_A.
Definition: KeyEvent.java:629
static final short VK_O
See VK_A.
Definition: KeyEvent.java:623
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
Definition: GLWindow.java:121
final int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Definition: GLWindow.java:466
final void setPosition(final int x, final int y)
Sets the location of the window's client area excluding insets (window decorations) in window units.
Definition: GLWindow.java:525
final void addKeyListener(final KeyListener l)
Appends the given com.jogamp.newt.event.KeyListener to the end of the list.
Definition: GLWindow.java:902
final int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
Definition: GLWindow.java:461
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
Definition: GLWindow.java:615
final void setSurfaceSize(final int pixelWidth, final int pixelHeight)
Sets the size of the window's surface in pixel units which claims the window's client area excluding ...
Definition: GLWindow.java:629
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
Definition: GLWindow.java:882
final int getHeight()
Returns the height of the client area excluding insets (window decorations) in window units.
Definition: GLWindow.java:451
final void setUndecorated(final boolean value)
Definition: GLWindow.java:337
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
Definition: GLWindow.java:605
final int getWidth()
Returns the width of the client area excluding insets (window decorations) in window units.
Definition: GLWindow.java:446
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Definition: GLWindow.java:169
static MonitorDevice getMonitorDevice(final StereoDevice stereoDevice, final boolean adjustRotation)
Returns the StereoDevice's associated MonitorDevice or null, if none is attached.
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
static GLProfile getMaxProgrammable(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the programmable shader pipeline.
Definition: GLProfile.java:831
Side-By-Side (SBS) 3D Movie Player for StereoClientRenderer.
static final StereoGLMediaEventListener stereoGLMediaEventListener
Simple planar movie player w/ orthogonal 1:1 projection.
All distortions, no multisampling, bilinear filtering, manual-swap and using two FBOs (default,...
static void main(final String args[])
void doIt(final StereoDeviceFactory.DeviceType deviceType, final int deviceIndex, final int posx, final int posy, final StereoGLEventListener upstream, final MovieSBSStereo movieSimple, final Uri movieURI, final boolean biLinear, final int numSamples, final boolean useSingleFBO, final boolean useRecommendedDistortionBits, final boolean useVignette, final boolean useChromatic, final boolean useTimewarp, final boolean useAutoSwap, final boolean useAnimator, final boolean exclusiveContext)
void setVerbose(final boolean v)
Definition: GearsES2.java:138
void setZ(final float zNear, final float zFar, final float zViewDist)
Definition: GearsES2.java:346
static int atoi(final String str, final int def)
Definition: MiscUtils.java:60
static boolean atob(final String str, final boolean def)
Definition: MiscUtils.java:51
static long atol(final String str, final long def)
Definition: MiscUtils.java:69
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final synchronized Thread setExclusiveContext(final Thread t)
Dedicate all GLAutoDrawable's context to the given exclusive context thread.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
Definition: Animator.java:344
final synchronized boolean stop()
Stops this animator.
Definition: Animator.java:368
StereoClientRenderer utilizing StereoDeviceRenderer implementing GLEventListener for convenience.
final void addGLEventListener(final StereoGLEventListener l)
Platform agnostic StereoDevice factory.
abstract void shutdown()
Shutdown factory if valid.
static StereoDeviceFactory createFactory(final DeviceType type)
final StereoDevice createDevice(final int deviceIndex, final StereoDeviceConfig config, final boolean verbose)
static String distortionBitsToString(final int distortionBits)
See StereoDeviceRenderer#getDistortionBits().
Definition: StereoUtil.java:78
StereoDevice type used for createFactory(type).
Default
Auto selection of device in the following order:
Immutable Dimension Interface, consisting of it's read only components:
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
boolean invoke(boolean wait, GLRunnable glRunnable)
Enqueues a one-shot GLRunnable, which will be executed within the next display() call after all regis...
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
void setAutoSwapBufferMode(boolean enable)
Enables or disables automatic buffer swapping for this drawable.
static final int GL_NEAREST
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_NEAREST" with express...
Definition: GL.java:715
GLMediaPlayer interface specifies a TextureSequence state machine using a multiplexed audio/video str...
void addEventListener(GLMediaEventListener l)
Adds a GLMediaEventListener to this player.
Object attachObject(String name, Object obj)
Attaches the user object for the given name.
static final int STREAM_ID_AUTO
Constant {@value} for auto or unspecified.
Stereoscopic device rendering interface.
static final int DISTORTION_CHROMATIC
Distortion Bit: Chromatic distortion compensating lens chromatic aberration.
ViewerPose getLastViewerPose()
Returns the last ViewerPose.
Interface describing a native stereoscopic device.
DimensionImmutable getSurfaceSize()
Returns the required surface size in pixel in target space.
Vec3f getDefaultEyePositionOffset()
Return the device default eye position offset for createRenderer(int, int, Vec3f, FovHVHalves[],...
int getMinimumDistortionBits()
Returns the minimum distortion compensation bits as required by the StereoDeviceRenderer,...
boolean startSensors(int desiredSensorBits, int requiredSensorBits)
Start desired and required sensors.
PointImmutable getPosition()
If operation within a device spanning virtual desktop, returns the device position.
int getRecommendedDistortionBits()
Returns the recommended distortion compensation bits for the StereoDeviceRenderer,...
boolean getSensorsStarted()
Return true if sensors have been started, false otherwise.
StereoDeviceRenderer createRenderer(final int distortionBits, final int textureCount, final Vec3f eyePositionOffset, final FovHVHalves[] eyeFov, final float pixelsPerDisplayPixel, final int textureUnit)
Create a new StereoDeviceRenderer instance.
FovHVHalves[] getDefaultFOV()
Returns the device default FovHVHalves for all supported eyes in natural order, i....
void resetLocationSensorOrigin()
Sets the location sensor's origin of this device to the current position.
int getSupportedSensorBits()
Returns the supported sensor capability bits, e.g.
void dispose()
Disposes this StereoDevice, if valid.
int getRequiredRotation()
Returns the CCW rotation as required by this display device.
Extended GLEventListener and CustomGLEventListener interface supporting stereoscopic client rendering...