summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-common.xml2
-rw-r--r--make/build-oculusvr.xml183
-rw-r--r--make/config/oculusvr/oculusvr-common.cfg12
-rw-r--r--make/config/oculusvr/oculusvr.c3
-rwxr-xr-xmake/scripts/make.jogl.all.macosx-java6.sh5
-rwxr-xr-xmake/scripts/make.jogl.all.macosx.sh1
-rwxr-xr-xmake/scripts/tests-win.bat4
-rw-r--r--make/scripts/tests.sh3
m---------oculusvr-sdk0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/JoglVersion.java17
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java26
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/FovHVHalves.java20
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Matrix4.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java75
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java330
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/LocationSensorParameter.java51
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java7
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java93
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java41
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java (renamed from src/jogl/classes/com/jogamp/opengl/util/stereo/EyePose.java)31
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceConfig.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceFactory.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/ProjectFloat.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java83
-rw-r--r--src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java46
-rw-r--r--src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c2
-rw-r--r--src/jogl/native/openmax/omx_tool.h1
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java6
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java81
-rw-r--r--src/newt/native/bcm_vc_iv.c2
-rw-r--r--src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java39
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java130
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java11
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java101
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java37
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java235
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/stereo/StereoDemo01.java36
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java22
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java24
50 files changed, 1534 insertions, 347 deletions
diff --git a/make/build-common.xml b/make/build-common.xml
index 5be5fedc7..1d408a057 100644
--- a/make/build-common.xml
+++ b/make/build-common.xml
@@ -239,7 +239,7 @@
<property name="rootrel.oculusvr.sdk" value="oculusvr-sdk"/>
<property name="rel.oculusvr.sdk" value="${project.root}/${rootrel.oculusvr.sdk}"/>
<condition property="oculusvr.sdk.available">
- <available file="${rel.oculusvr.sdk}/LibOVR/Src/OVR_CAPI.h"/>
+ <available file="${rel.oculusvr.sdk}/LibOVR/Include/OVR_CAPI.h"/>
</condition>
<property name="results.test" value="${build}/test/results" />
diff --git a/make/build-oculusvr.xml b/make/build-oculusvr.xml
index 1d280d882..b89b66fb7 100644
--- a/make/build-oculusvr.xml
+++ b/make/build-oculusvr.xml
@@ -62,19 +62,29 @@
<property name="classes" value="${build.oculusvr}/classes" />
<!-- The OculusVR headers from which Java files are generated -->
+ <property name="stub.includes.kern" value="${rel.oculusvr.sdk}/LibOVRKernel/Src" />
+ <property name="stub.includes.inc" value="${rel.oculusvr.sdk}/LibOVR/Include" />
<property name="stub.includes.ovr" value="${rel.oculusvr.sdk}/LibOVR/Src" />
- <property name="stub.includes.all.ovr" value="${stub.includes.ovr},${stub.includes.ovr}/CAPI" />
+ <property name="stub.includes.all.ovr" value="${stub.includes.kern},${stub.includes.inc},${stub.includes.ovr},${stub.includes.ovr}/CAPI" />
<echo message="rel.oculusvr.sdk ${rel.oculusvr.sdk}" />
+ <echo message="stub.includes.kern ${stub.includes.kern}" />
+ <echo message="stub.includes.inc ${stub.includes.inc}" />
<echo message="stub.includes.ovr ${stub.includes.ovr}" />
<echo message="stub.includes.all.ovr ${stub.includes.all.ovr}"/>
- <fileset id="stub.includes.dependencies.fileset.1" dir="${stub.includes.ovr}">
+ <fileset id="stub.includes.dependencies.fileset.1" dir="${stub.includes.kern}">
+ <include name="**" />
+ </fileset>
+ <fileset id="stub.includes.dependencies.fileset.2" dir="${stub.includes.inc}">
+ <include name="**" />
+ </fileset>
+ <fileset id="stub.includes.dependencies.fileset.3" dir="${stub.includes.ovr}">
<include name="**" />
</fileset>
<!-- echo message="stub.includes.dependencies.fileset.1 ${toString:stub.includes.dependencies.fileset.1}"/ -->
- <fileset id="stub.includes.dependencies.fileset.2" file="${gluegen.jar}" />
- <fileset id="stub.includes.dependencies.fileset.3" dir="${config.oculusvr}">
+ <fileset id="stub.includes.dependencies.fileset.4" file="${gluegen.jar}" />
+ <fileset id="stub.includes.dependencies.fileset.5" dir="${config.oculusvr}">
<include name="*.cfg" />
<include name="*.java" />
<include name="*.c" />
@@ -125,6 +135,8 @@
<srcfileset refid="stub.includes.dependencies.fileset.1" />
<srcfileset refid="stub.includes.dependencies.fileset.2" />
<srcfileset refid="stub.includes.dependencies.fileset.3" />
+ <srcfileset refid="stub.includes.dependencies.fileset.4" />
+ <srcfileset refid="stub.includes.dependencies.fileset.5" />
<targetfileset dir="${src.generated}">
<include name="**/*.java" />
<include name="**/*.c" />
@@ -138,6 +150,8 @@
<srcfiles refid="stub.includes.dependencies.fileset.1" />
<srcfiles refid="stub.includes.dependencies.fileset.2" />
<srcfiles refid="stub.includes.dependencies.fileset.3" />
+ <srcfiles refid="stub.includes.dependencies.fileset.4" />
+ <srcfiles refid="stub.includes.dependencies.fileset.5" />
</uptodate>
<condition property="java.generate.skip">
@@ -417,67 +431,67 @@
<include name="${rootrel.generated.c}/OVR_JNI.c"/>
</patternset>
<patternset id="c.src.files.oculusvr.cpp">
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_CAPI.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp"/>
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GL_DistortionRenderer.cpp"/-->
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GL_HSWDisplay.cpp"/-->
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GL_Util.cpp"/-->
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/GL/CAPI_GLE.cpp"/-->
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_FrameTimeManager.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HMDRenderState.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HMDState.cpp"/>
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HSWDisplay.cpp"/ -->
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_LatencyStatistics.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Alg.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Allocator.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Atomic.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Callbacks.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_CRC32.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_File.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_FileFILE.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_JSON.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Lockless.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Log.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Rand.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_RefCount.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_SharedMemory.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Std.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_String.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_String_FormatUtil.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_String_PathUtil.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_SysFile.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_System.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_ThreadCommandQueue.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_ThreadsPthread.cpp" if="isLinux"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_ThreadsPthread.cpp" if="isOSX"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_ThreadsWinAPI.cpp" if="isWindows"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_Timer.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Kernel/OVR_UTF8Util.cpp"/>
+
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_Direct3D.cpp" if="isWindows"/ -->
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_GetSystemSpecs.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_ImageWindow.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_LongPollThread.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_SystemGUI.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_SystemInfo.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_Watchdog.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_SystemGUI_OSX.mm" if="isOSX"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVRKernel/Src/Util/Util_SystemInfo_OSX.mm" if="isOSX"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_JSON.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_CAPI.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_CAPI_Util.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Linux_UDEV.cpp" if="isLinux"/>
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Profile.cpp"/>
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_SerialFormat.cpp"/>
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_Stereo.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/OVR_StereoProjection.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Alg.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Allocator.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Atomic.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_CRC32.cpp"/>
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_DebugHelp.cpp"/ -->
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_File.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_FileFILE.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Lockless.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Log.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Math.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_RefCount.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_SharedMemory.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Std.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_String.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_String_FormatUtil.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_String_PathUtil.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_SysFile.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_System.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadCommandQueue.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsPthread.cpp" if="isLinux"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsPthread.cpp" if="isOSX"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp" if="isWindows"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_Timer.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Kernel/OVR_UTF8Util.cpp"/>
-
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_ImageWindow.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_Interface.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_LatencyTest2Reader.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_Render_Stereo.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_SystemGUI.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_SystemGUI_OSX.mm" if="isOSX"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_SystemInfo.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_SystemInfo_OSX.mm" if="isOSX"/>
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp"/ -->
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_DistortionTiming.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_FrameLatencyTracker.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_FrameTimeManager3.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HMDRenderState.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HMDState.cpp"/>
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/CAPI/CAPI_HSWDisplay.cpp"/ -->
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Display.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Linux_Display.cpp" if="isLinux"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Linux_SDKWindow.cpp" if="isLinux"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_OSX_Display.cpp" if="isOSX"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_Display.cpp" if="isWindows"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_FocusReader.cpp" if="isWindows"/>
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Linux_Display.cpp" if="isLinux"/ -->
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Linux_SDKWindow.cpp" if="isLinux"/ -->
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_OSX_Display.cpp" if="isOSX"/ -->
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_Display.cpp" if="isWindows"/ -->
+ <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_FocusReader.cpp" if="isWindows"/ -->
<!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_RenderShim.cpp" if="isWindows"/ -->
<!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_Win32_ShimFunctions.cpp" if="isWindows"/ -->
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_OSX_FocusObserver.mm" if="isOSX"/ -->
- <!-- include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Displays/OVR_OSX_FocusReader.mm" if="isOSX"/ -->
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_BitStream.cpp"/>
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_NetworkPlugin.cpp"/>
@@ -488,14 +502,20 @@
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Unix_Socket.cpp" if="isLinux"/>
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Unix_Socket.cpp" if="isOSX"/>
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Net/OVR_Win32_Socket.cpp" if="isWindows"/>
+
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Service/Service_NetClient.cpp"/>
<include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Service/Service_NetSessionCommon.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Service/Service_Win32_FastIPC_Client.cpp" if="isWindows"/>
- <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Tracking/Tracking_SensorStateReader.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_Interface.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_LatencyTest2Reader.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_MatFile.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Util/Util_Render_Stereo.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/3rdParty/TinyXml/tinyxml2.cpp"/>
+ <include name="${rootrel.oculusvr.sdk}/LibOVR/Src/Vision/SensorFusion/Vision_SensorStateReader.cpp"/>
- <include name="${rootrel.oculusvr.sdk}/3rdParty/EDID/edid.cpp" if="isLinux"/>
+ <!-- include name="${rootrel.oculusvr.sdk}/3rdParty/TinyXml/tinyxml2.cpp"/ -->
+ <!-- include name="${rootrel.oculusvr.sdk}/3rdParty/EDID/edid.cpp" if="isLinux"/ -->
</patternset>
<echo message="Compiling @{output.lib.name}" />
@@ -530,6 +550,8 @@
<sysincludepath path="${java.includes.dir}"/>
<sysincludepath path="${java.includes.dir.platform}"/>
<sysincludepath path="${stub.includes.gluegen.cc}"/>
+ <includepath path="${stub.includes.kern}"/>
+ <includepath path="${stub.includes.inc}"/>
<includepath path="${stub.includes.ovr}"/>
<includepath path="${stub.includes.ovr}/CAPI"/>
@@ -537,8 +559,12 @@
<includepath path="${src.c}"/>
<includepath path="${src.generated.c}" />
- <compilerarg location="start" value="-ObjC" if="isOSX"/>
+ <compilerarg location="start" value="-ObjC" if="isOSX"/>
+ <compilerarg location="start" value="-mmacosx-version-min=10.7" if="isOSX"/>
+ <compilerarg value="-municode" if="isMingW"/>
+ <compilerarg value="-DUNICODE" if="isMingW"/>
+ <compilerarg value="-D_UNICODE" if="isMingW"/>
</compiler>
</cc>
<!-- C++ Compilation -->
@@ -558,6 +584,8 @@
<sysincludepath path="${java.includes.dir}"/>
<sysincludepath path="${java.includes.dir.platform}"/>
<sysincludepath path="${stub.includes.gluegen.cc}"/>
+ <includepath path="${stub.includes.kern}"/>
+ <includepath path="${stub.includes.inc}"/>
<includepath path="${stub.includes.ovr}"/>
<includepath path="${stub.includes.ovr}/CAPI"/>
@@ -565,16 +593,28 @@
<includepath path="${src.c}"/>
<includepath path="${src.generated.c}" />
- <compilerarg location="start" value="-ObjC++" if="isOSX"/>
- <compilerarg location="start" value="-x" if="isCLANG" unless="isOSX"/>
- <compilerarg location="start" value="c++" if="isCLANG" unless="isOSX"/>
-
+ <compilerarg location="start" value="-ObjC++" if="isOSX"/>
+ <compilerarg location="start" value="-x" if="isCLANG" unless="isOSX"/>
+ <compilerarg location="start" value="c++" if="isCLANG" unless="isOSX"/>
+ <!--
+ <compilerarg location="start" value="-x" if="isCLANG"/>
+ <compilerarg location="start" value="c++" if="isCLANG"/>
+ -->
+ <compilerarg location="start" value="-stdlib=libc++" if="isOSX"/>
+ <compilerarg location="start" value="-mmacosx-version-min=10.7" if="isOSX"/>
+
+ <compilerarg value="-std=c++11"/>
<compilerarg value="-fno-rtti"/>
+ <compilerarg value="-fno-strict-aliasing"/>
+ <compilerarg value="-msse2"/> <!-- oops FIXME -->
+
<compilerarg value="-DHEADLESS_APP=1"/>
+ <!-- compilerarg value="-DOVR_PRIVATE_FILE=''"/ -->
+ <compilerarg value="-DOVR_STATIC_BUILD"/>
- <compilerarg value="-municode" if="isMingW"/>
- <compilerarg value="-DUNICODE" if="isMingW"/>
- <compilerarg value="-D_UNICODE" if="isMingW"/>
+ <compilerarg value="-municode" if="isMingW"/>
+ <compilerarg value="-DUNICODE" if="isMingW"/>
+ <compilerarg value="-D_UNICODE" if="isMingW"/>
</compiler>
</cc>
<!-- Linkage -->
@@ -606,12 +646,15 @@
<syslibset dir="/usr/lib/amd64" libs="X11 Xrandr udev m" if="isSolarisAMD64"/>
<syslibset dir="/usr/lib/sparcv9" libs="X11 Xrandr udev m" if="isSolarisSparcv9"/>
+ <linkerarg location="start" value="-mmacosx-version-min=10.7" if="isOSX"/>
+
<!-- syslibset libs="stdc++"
Don't link dynamic
Static link directive must be at the end! -->
- <linkerarg location="end" value="-Wl,-Bstatic" if="isGCC"/>
- <linkerarg location="end" value="-lstdc++" />
- <linkerarg location="end" value="-Wl,-Bdynamic" if="isGCC"/>
+ <linkerarg location="end" value="-Wl,-Bstatic" if="isGCC" unless="isOSX"/>
+ <linkerarg location="end" value="-lstdc++" unless="isOSX"/>
+ <linkerarg location="end" value="-Wl,-Bdynamic" if="isGCC" unless="isOSX"/>
+ <linkerarg location="end" value="-lc++" if="isOSX"/>
</linker>
</cc>
diff --git a/make/config/oculusvr/oculusvr-common.cfg b/make/config/oculusvr/oculusvr-common.cfg
index 86d0ce745..cf8419d70 100644
--- a/make/config/oculusvr/oculusvr-common.cfg
+++ b/make/config/oculusvr/oculusvr-common.cfg
@@ -22,13 +22,23 @@ Ignore ovrRenderAPIConfig.PlatformData
# Not native sized: CType['uintptr_t *', size [fixed false, lnx64 64], [array*1]]
Ignore ovrTexture.PlatformData
+# FIXME: Add wrapper for native/java callbacks
+Ignore ovrLogCallback
+Ignore ovrInitParams.LogCallback
+
# We use the SDK in headless mode:
# #define HEADLESS_APP 1
# implying: ovrHmdCap_ExtendDesktop
#
+# SDK rendering disabled
Ignore ovr_InitializeRenderingShim
-Ignore ovrHmd_RegisterPostDistortionCallback
+Ignore ovr_InitializeRenderingShimVersion
+Ignore ovrHmd_ConfigureRendering
Ignore ovrHmd_AttachToWindow
+Ignore ovrHmd_BeginFrame
+Ignore ovrHmd_EndFrame
+# misc
+Ignore ovrHmd_RegisterPostDistortionCallback
# HSW = Health and Safety Warning
Ignore ovrHSWDisplayState
Ignore ovrHmd_GetHSWDisplayState
diff --git a/make/config/oculusvr/oculusvr.c b/make/config/oculusvr/oculusvr.c
index 35f86eb78..a3a9a3512 100644
--- a/make/config/oculusvr/oculusvr.c
+++ b/make/config/oculusvr/oculusvr.c
@@ -6,4 +6,7 @@ typedef struct ovrHmdStruct {
#define OVR_ALIGNAS(n)
+/** Removed in 0.5.0, but permanently enabled! */
+#define ovrDistortionCap_Chromatic 0x01
+
#include "OVR_CAPI.h"
diff --git a/make/scripts/make.jogl.all.macosx-java6.sh b/make/scripts/make.jogl.all.macosx-java6.sh
index 2dfcb372e..4dd4a2619 100755
--- a/make/scripts/make.jogl.all.macosx-java6.sh
+++ b/make/scripts/make.jogl.all.macosx-java6.sh
@@ -25,6 +25,7 @@ export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
+# BUILD_ARCHIVE=true \
ant \
- -Drootrel.build=build-macosx \
- $* 2>&1 | tee make.jogl.all.macosx.log
+ -Drootrel.build=build-macosx-java6 \
+ $* 2>&1 | tee make.jogl.all.macosx-java6.log
diff --git a/make/scripts/make.jogl.all.macosx.sh b/make/scripts/make.jogl.all.macosx.sh
index dd5415b78..aa85b9213 100755
--- a/make/scripts/make.jogl.all.macosx.sh
+++ b/make/scripts/make.jogl.all.macosx.sh
@@ -25,6 +25,7 @@ export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
+# BUILD_ARCHIVE=true \
ant \
-Drootrel.build=build-macosx \
$* 2>&1 | tee make.jogl.all.macosx.log
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index 0f73de53d..671ba600d 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -93,6 +93,8 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMapBuffer01
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext01NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext02NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug692GL3VAO %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestBug1146GLContextDialogToolTipAWT %*
+
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimNEWT %*
@@ -221,4 +223,4 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewt
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01
-scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.stereo.StereoDemo01 %*
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index eeec83ec1..da5e0f3ad 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -409,7 +409,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWTNoARBCtx $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile03NEWTOffscreen $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile04NEWTOffscreenNoARBCtx $*
-testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $*
#
# Stereo
@@ -593,6 +593,7 @@ testawt com.jogamp.opengl.test.junit.jogl.acore.TestVersionSemanticsNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAWTCloseX11DisplayBug565 $*
+testawt com.jogamp.opengl.test.junit.jogl.acore.TestBug1146GLContextDialogToolTipAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLWindow01NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.anim.TestAnimatorGLJPanel01AWT $*
diff --git a/oculusvr-sdk b/oculusvr-sdk
-Subproject 3c7b8a17e907f4ef2afd9f77db566a3f6179cbe
+Subproject eea4866ec9af301985d3eb2f648b8c95661fae2
diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
index af16348a8..7589b3776 100644
--- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
+++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
@@ -129,7 +129,14 @@ public class JoglVersion extends JogampVersion {
public static StringBuilder getGLInfo(final GL gl, final StringBuilder sb) {
return getGLInfo(gl, sb, false);
}
- public static StringBuilder getGLInfo(final GL gl, StringBuilder sb, final boolean withCapabilitiesAndExtensionInfo) {
+ public static StringBuilder getGLInfo(final GL gl, final StringBuilder sb, final boolean withCapabilitiesAndExtensionInfo) {
+ return getGLInfo(gl, sb, true, withCapabilitiesAndExtensionInfo, withCapabilitiesAndExtensionInfo);
+ }
+
+ public static StringBuilder getGLInfo(final GL gl, StringBuilder sb,
+ final boolean withAvailabilityInfo,
+ final boolean withCapabilitiesInfo,
+ final boolean withExtensionInfo) {
final AbstractGraphicsDevice device = gl.getContext().getGLDrawable().getNativeSurface()
.getGraphicsConfiguration().getScreen().getDevice();
if(null==sb) {
@@ -139,12 +146,14 @@ public class JoglVersion extends JogampVersion {
sb.append(VersionUtil.SEPERATOR).append(Platform.getNewline());
sb.append(device.getClass().getSimpleName()).append("[type ")
.append(device.getType()).append(", connection ").append(device.getConnection()).append("]: ").append(Platform.getNewline());
- GLProfile.glAvailabilityToString(device, sb, "\t", 1);
+ if( withAvailabilityInfo ) {
+ GLProfile.glAvailabilityToString(device, sb, "\t", 1);
+ }
sb.append(Platform.getNewline());
- sb = getGLStrings(gl, sb, withCapabilitiesAndExtensionInfo);
+ sb = getGLStrings(gl, sb, withExtensionInfo);
- if( withCapabilitiesAndExtensionInfo ) {
+ if( withCapabilitiesInfo ) {
sb = getAllAvailableCapabilitiesInfo(device, sb);
}
return sb;
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
index a04055430..7f630f9d5 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
@@ -35,6 +35,7 @@ import jogamp.opengl.Debug;
import com.jogamp.common.os.Platform;
import com.jogamp.opengl.math.geom.AABBox;
+import com.jogamp.opengl.math.geom.Frustum;
/**
* Basic Float math utility functions.
@@ -491,18 +492,18 @@ public final class FloatUtil {
* @param zNear
* @param zFar
* @return given matrix for chaining
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0,
- * or if left == right, or bottom == top, or zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * or {@code left == right}, or {@code bottom == top}.
*/
public static float[] makeFrustum(final float[] m, final int m_offset, final boolean initM,
final float left, final float right,
final float bottom, final float top,
final float zNear, final float zFar) throws GLException {
- if( zNear <= 0.0f || zFar < 0.0f ) {
- throw new GLException("GL_INVALID_VALUE: zNear and zFar must be positive, and zNear>0");
+ if( zNear <= 0.0f || zFar <= zNear ) {
+ throw new GLException("Requirements zNear > 0 and zFar > zNear, but zNear "+zNear+", zFar "+zFar);
}
- if( left == right || top == bottom || zNear == zFar ) {
- throw new GLException("GL_INVALID_VALUE: top,bottom and left,right and zNear,zFar must not be equal");
+ if( left == right || top == bottom) {
+ throw new GLException("GL_INVALID_VALUE: top,bottom and left,right must not be equal");
}
if( initM ) {
// m[m_offset+0+4*0] = 1f;
@@ -565,14 +566,15 @@ public final class FloatUtil {
* @param zNear
* @param zFar
* @return given matrix for chaining
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * @see #makeFrustum(float[], int, boolean, float, float, float, float, float, float)
*/
public static float[] makePerspective(final float[] m, final int m_off, final boolean initM,
final float fovy_rad, final float aspect, final float zNear, final float zFar) throws GLException {
final float top = tan(fovy_rad/2f) * zNear; // use tangent of half-fov !
- final float bottom = -1.0f * top;
- final float left = aspect * bottom;
- final float right = aspect * top;
+ final float bottom = -1.0f * top; // -1f * fovhvTan.top * zNear
+ final float left = aspect * bottom; // aspect * -1f * fovhvTan.top * zNear
+ final float right = aspect * top; // aspect * fovhvTan.top * zNear
return makeFrustum(m, m_off, initM, left, right, bottom, top, zNear, zFar);
}
@@ -591,7 +593,9 @@ public final class FloatUtil {
* @param zNear
* @param zFar
* @return given matrix for chaining
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * @see #makeFrustum(float[], int, boolean, float, float, float, float, float, float)
+ * @see Frustum#updateByFovDesc(float[], int, boolean, Frustum.FovDesc)
*/
public static float[] makePerspective(final float[] m, final int m_offset, final boolean initM,
final FovHVHalves fovhv, final float zNear, final float zFar) throws GLException {
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FovHVHalves.java b/src/jogl/classes/com/jogamp/opengl/math/FovHVHalves.java
index 26ed57009..5d7907f2f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FovHVHalves.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FovHVHalves.java
@@ -35,13 +35,13 @@ package com.jogamp.opengl.math;
* </p>
*/
public final class FovHVHalves {
- /** Half horizontal FOV from center to left. */
+ /** Half horizontal FOV from center to left, either in {@link #inTangents} or radians. */
public final float left;
- /** Half horizontal FOV from center to right. */
+ /** Half horizontal FOV from center to right, either in {@link #inTangents} or radians. */
public final float right;
- /** Half vertical FOV from center to top. */
+ /** Half vertical FOV from center to top, either in {@link #inTangents} or radians. */
public final float top;
- /** Half vertical FOV from center to bottom. */
+ /** Half vertical FOV from center to bottom, either in {@link #inTangents} or radians. */
public final float bottom;
/** If true, values are in tangent, otherwise radians.*/
public final boolean inTangents;
@@ -67,7 +67,7 @@ public final class FovHVHalves {
}
/**
- * Returns a symmetrical centered {@link FovHVHalves} instance in tangents, using:
+ * Returns a symmetrical centered {@link FovHVHalves} instance in {@link #inTangents}, using:
* <pre>
halfHorizFovTan = tan( horizontalFov / 2f );
halfVertFovTan = tan( verticalFov / 2f );
@@ -82,7 +82,7 @@ public final class FovHVHalves {
}
/**
- * Returns a symmetrical centered {@link FovHVHalves} instance in tangents, using:
+ * Returns a symmetrical centered {@link FovHVHalves} instance in {@link #inTangents}, using:
* <pre>
top = bottom = tan( verticalFov / 2f );
left = right = aspect * top;
@@ -99,7 +99,7 @@ public final class FovHVHalves {
}
/**
- * Returns a custom symmetry {@link FovHVHalves} instance in tangents, using:
+ * Returns a custom symmetry {@link FovHVHalves} instance {@link #inTangents}, using:
* <pre>
left = tan( horizontalFov * horizCenterFromLeft )
right = tan( horizontalFov * ( 1f - horizCenterFromLeft ) )
@@ -121,7 +121,7 @@ public final class FovHVHalves {
}
/**
- * Returns a custom symmetry {@link FovHVHalves} instance in tangents,
+ * Returns a custom symmetry {@link FovHVHalves} instance {@link #inTangents},
* via computing the <code>horizontalFov</code> using:
* <pre>
halfVertFovTan = tan( verticalFov / 2f );
@@ -157,10 +157,10 @@ public final class FovHVHalves {
}
}
- /** Returns the full horizontal FOV, i.e. {@link #left} + {@link #right}. */
+ /** Returns the full horizontal FOV, i.e. {@link #left} + {@link #right}, either in {@link #inTangents} or radians. */
public final float horzFov() { return left+right; }
- /** Returns the full vertical FOV, i.e. {@link #top} + {@link #bottom}. */
+ /** Returns the full vertical FOV, i.e. {@link #top} + {@link #bottom}, either in {@link #inTangents} or radians. */
public final float vertFov() { return top+bottom; }
public final String toString() {
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java b/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java
index 421bb909f..a080d4442 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java
@@ -147,8 +147,9 @@ public class Matrix4 {
* @param top
* @param zNear
* @param zFar
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0,
- * or if left == right, or bottom == top, or zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * or {@code left == right}, or {@code bottom == top}.
+ * @see FloatUtil#makeFrustum(float[], int, boolean, float, float, float, float, float, float)
*/
public final void makeFrustum(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws GLException {
multMatrix( FloatUtil.makeFrustum(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar) );
@@ -159,7 +160,8 @@ public class Matrix4 {
* @param aspect
* @param zNear
* @param zFar
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * @see FloatUtil#makePerspective(float[], int, boolean, float, float, float, float)
*/
public final void makePerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar) throws GLException {
multMatrix( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_rad, aspect, zNear, zFar) );
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
index b73bad613..8b0fa559e 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
@@ -30,6 +30,8 @@ package com.jogamp.opengl.math.geom;
import jogamp.common.os.PlatformPropsImpl;
import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.opengl.math.FovHVHalves;
/**
* Providing frustum {@link #getPlanes() planes} derived by different inputs
@@ -77,6 +79,35 @@ import com.jogamp.common.os.Platform;
* </p>
*/
public class Frustum {
+ /**
+ * {@link Frustum} description by {@link #fovhv} and {@link #zNear}, {@link #zFar}.
+ */
+ public static class FovDesc {
+ /** Field of view in both directions, may not be centered, either {@link FovHVHalves#inTangents} or radians. */
+ public final FovHVHalves fovhv;
+ /** Near Z */
+ public final float zNear;
+ /** Far Z */
+ public final float zFar;
+ /**
+ * @param fovhv field of view in both directions, may not be centered, either {@link FovHVHalves#inTangents} or radians
+ * @param zNear
+ * @param zFar
+ * @throws IllegalArgumentException if {@code zNear <= 0} or {@code zFar <= zNear}.
+ */
+ public FovDesc(final FovHVHalves fovhv, final float zNear, final float zFar) throws IllegalArgumentException {
+ if( zNear <= 0.0f || zFar <= zNear ) {
+ throw new IllegalArgumentException("Requirements zNear > 0 and zFar > zNear, but zNear "+zNear+", zFar "+zFar);
+ }
+ this.fovhv = fovhv;
+ this.zNear = zNear;
+ this.zFar = zFar;
+ }
+ public final String toString() {
+ return "FrustumFovDesc["+fovhv.toStringInDegrees()+", Z["+zNear+" - "+zFar+"]]";
+ }
+ }
+
/** Normalized planes[l, r, b, t, n, f] */
protected final Plane[] planes = new Plane[6];
@@ -176,19 +207,47 @@ public class Frustum {
*/
public final void updateByPlanes(final Plane[] src) {
for (int i = 0; i < 6; ++i) {
- final Plane p0 = planes[i];
- final float[] p0_n = p0.n;
- final Plane p1 = src[i];
- final float[] p1_n = p1.n;
- p0_n[0] = p1_n[0];
- p0_n[1] = p1_n[1];
- p0_n[2] = p1_n[2];
- p0.d = p1.d;
+ final Plane pD = planes[i];
+ final Plane pS = src[i];
+ pD.d = pS.d;
+ System.arraycopy(pS.n, 0, pD.n, 0, 3);
}
}
/**
* Calculate the frustum planes in world coordinates
+ * using the passed {@link FovDesc}.
+ * <p>
+ * Operation Details:
+ * <ul>
+ * <li>The given {@link FovDesc} will be transformed
+ * into the given float[16] as a perspective matrix (column major order) first,
+ * see {@link FloatUtil#makePerspective(float[], int, boolean, FovHVHalves, float, float)}.</li>
+ * <li>Then the float[16] perspective matrix is used to {@link #updateByPMV(float[], int)} this instance.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Frustum plane's normals will point to the inside of the viewing frustum,
+ * as required by this class.
+ * </p>
+ *
+ * @param m 4x4 matrix in column-major order (also result)
+ * @param m_offset offset in given array <i>m</i>, i.e. start of the 4x4 matrix
+ * @param initM if true, given matrix will be initialized w/ identity matrix,
+ * otherwise only the frustum fields are set.
+ * @param fovDesc {@link Frustum} {@link FovDesc}
+ * @return given matrix for chaining
+ * @see FloatUtil#makePerspective(float[], int, boolean, FovHVHalves, float, float)
+ */
+ public float[] updateByFovDesc(final float[] m, final int m_offset, final boolean initM,
+ final FovDesc fovDesc) {
+ FloatUtil.makePerspective(m, m_offset, initM, fovDesc.fovhv, fovDesc.zNear, fovDesc.zFar);
+ updateByPMV(m, 0);
+ return m;
+ }
+
+ /**
+ * Calculate the frustum planes in world coordinates
* using the passed float[16] as premultiplied P*MV (column major order).
* <p>
* Frustum plane's normals will point to the inside of the viewing frustum,
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 57f9301b8..196acf9ab 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -663,8 +663,9 @@ public final class PMVMatrix implements GLMatrixFunc {
/**
* {@inheritDoc}
*
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0,
- * or if left == right, or bottom == top, or zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * or {@code left == right}, or {@code bottom == top}.
+ * @see FloatUtil#makeFrustum(float[], int, boolean, float, float, float, float, float, float)
*/
@Override
public final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws GLException {
@@ -682,7 +683,8 @@ public final class PMVMatrix implements GLMatrixFunc {
* @param aspect aspect ratio width / height
* @param zNear
* @param zFar
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * @see FloatUtil#makePerspective(float[], int, boolean, float, float, float, float)
*/
public final void gluPerspective(final float fovy_deg, final float aspect, final float zNear, final float zFar) throws GLException {
glMultMatrixf( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0 );
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
index f8a66fe45..e1db3f7a3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -126,7 +126,7 @@ public class ShaderCode {
* @param source CharSequence array containing the shader sources, organized as <code>source[count][strings-per-shader]</code>.
* May be either an immutable <code>String</code> - or mutable <code>StringBuilder</code> array.
*
- * @throws IllegalArgumentException if <code>count</count> and <code>source.length</code> do not match
+ * @throws IllegalArgumentException if <code>count</code> and <code>source.length</code> do not match
*/
public ShaderCode(final int type, final int count, final CharSequence[][] source) {
if(source.length != count) {
@@ -189,7 +189,7 @@ public class ShaderCode {
* {@link GL4#GL_TESS_CONTROL_SHADER} or {@link GL4#GL_TESS_EVALUATION_SHADER}.
* @param count number of shaders
* @param context class used to help resolving the source location
- * @param sourceFiles array of source locations, organized as <code>sourceFiles[count]</code>
+ * @param sourceFiles array of source locations, organized as <code>sourceFiles[count]</code> -> <code>shaderSources[count][1]</code>
* @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
* which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
@@ -197,10 +197,11 @@ public class ShaderCode {
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
*
- * @throws IllegalArgumentException if <code>count</count> and <code>sourceFiles.length</code> do not match
+ * @throws IllegalArgumentException if <code>count</code> and <code>sourceFiles.length</code> do not match
* @see #readShaderSource(Class, String)
*/
- public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context, final String[] sourceFiles, final boolean mutableStringBuilder) {
+ public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context,
+ final String[] sourceFiles, final boolean mutableStringBuilder) {
if(null != gl && !ShaderUtil.isShaderCompilerAvailable(gl)) {
return null;
}
@@ -227,6 +228,53 @@ public class ShaderCode {
}
/**
+ * Creates a complete {@link ShaderCode} object while reading all shader sources from {@link Uri} <code>sourceLocations</code>
+ * via {@link #readShaderSource(Uri, boolean)}.
+ *
+ * @param gl current GL object to determine whether a shader compiler is available. If null, no validation is performed.
+ * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER}, {@link GL3#GL_GEOMETRY_SHADER},
+ * {@link GL4#GL_TESS_CONTROL_SHADER} or {@link GL4#GL_TESS_EVALUATION_SHADER}.
+ * @param count number of shaders
+ * @param sourceLocations array of {@link Uri} source locations, organized as <code>sourceFiles[count]</code> -> <code>shaderSources[count][1]</code>
+ * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
+ * which can be edited later on at the costs of a String conversion when passing to
+ * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
+ * If <code>false</code> method returns an immutable <code>String</code> instance,
+ * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
+ * at no additional costs.
+ *
+ * @throws IllegalArgumentException if <code>count</code> and <code>sourceFiles.length</code> do not match
+ * @see #readShaderSource(Uri, boolean)
+ * @since 2.3.2
+ */
+ public static ShaderCode create(final GL2ES2 gl, final int type, final int count,
+ final Uri[] sourceLocations, final boolean mutableStringBuilder) {
+ if(null != gl && !ShaderUtil.isShaderCompilerAvailable(gl)) {
+ return null;
+ }
+
+ CharSequence[][] shaderSources = null;
+ if(null!=sourceLocations) {
+ // sourceFiles.length and count is validated in ctor
+ shaderSources = new CharSequence[sourceLocations.length][1];
+ for(int i=0; i<sourceLocations.length; i++) {
+ try {
+ shaderSources[i][0] = readShaderSource(sourceLocations[i], mutableStringBuilder);
+ } catch (final IOException ioe) {
+ throw new RuntimeException("readShaderSource("+sourceLocations[i]+") error: ", ioe);
+ }
+ if(null == shaderSources[i][0]) {
+ shaderSources = null;
+ }
+ }
+ }
+ if(null==shaderSources) {
+ return null;
+ }
+ return new ShaderCode(type, count, shaderSources);
+ }
+
+ /**
* Creates a complete {@link ShaderCode} object while reading the shader binary of <code>binaryFile</code>,
* which location is resolved using the <code>context</code> class, see {@link #readShaderBinary(Class, String)}.
*
@@ -259,6 +307,37 @@ public class ShaderCode {
}
/**
+ * Creates a complete {@link ShaderCode} object while reading the shader binary from {@link Uri} <code>binLocations</code>
+ * via {@link #readShaderBinary(Uri)}.
+ * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER}, {@link GL3#GL_GEOMETRY_SHADER},
+ * {@link GL4#GL_TESS_CONTROL_SHADER} or {@link GL4#GL_TESS_EVALUATION_SHADER}.
+ * @param count number of shaders
+ * @param binFormat a valid native binary format as they can be queried by {@link ShaderUtil#getShaderBinaryFormats(GL)}.
+ * @param binLocations {@link Uri} binary location
+ *
+ * @see #readShaderBinary(Uri)
+ * @see ShaderUtil#getShaderBinaryFormats(GL)
+ * @since 2.3.2
+ */
+ public static ShaderCode create(final int type, final int count, int binFormat, final Uri binLocation) {
+ ByteBuffer shaderBinary = null;
+ if(null!=binLocation && 0<=binFormat) {
+ try {
+ shaderBinary = readShaderBinary(binLocation);
+ } catch (final IOException ioe) {
+ throw new RuntimeException("readShaderBinary("+binLocation+") error: ", ioe);
+ }
+ if(null == shaderBinary) {
+ binFormat = -1;
+ }
+ }
+ if(null==shaderBinary) {
+ return null;
+ }
+ return new ShaderCode(type, count, binFormat, shaderBinary);
+ }
+
+ /**
* Returns a unique suffix for shader resources as follows:
* <ul>
* <li>Source<ul>
@@ -327,7 +406,8 @@ public class ShaderCode {
* whatever is available first.
* <p>
* The source and binary location names are expected w/o suffixes which are
- * resolved and appended using {@link #getFileSuffix(boolean, int)}.
+ * resolved and appended using the given {@code srcSuffixOpt} and {@code binSuffixOpt}
+ * if not {@code null}, otherwise {@link #getFileSuffix(boolean, int)} determines the suffixes.
* </p>
* <p>
* Additionally, the binary resource is expected within a subfolder of <code>binRoot</code>
@@ -358,9 +438,11 @@ public class ShaderCode {
* Your invocation in org/test/glsl/MyShaderTest.java:
*
* ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(),
- * "shader", new String[] { "vertex" }, "shader/bin", "vertex");
+ * "shader", new String[] { "vertex" }, null,
+ * "shader/bin", "vertex", null, true);
* ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(),
- * "shader", new String[] { "vertex" }, "shader/bin", "fragment");
+ * "shader", new String[] { "vertex" }, null,
+ * "shader/bin", "fragment", null, true);
* ShaderProgram sp0 = new ShaderProgram();
* sp0.add(gl, vp0, System.err);
* sp0.add(gl, fp0, System.err);
@@ -380,8 +462,12 @@ public class ShaderCode {
* @param context class used to help resolving the source and binary location
* @param srcRoot relative <i>root</i> path for <code>srcBasenames</code> optional
* @param srcBasenames basenames w/o path or suffix relative to <code>srcRoot</code> for the shader's source code
+ * @param srcSuffixOpt optional custom suffix for shader's source file,
+ * if {@code null} {@link #getFileSuffix(boolean, int)} is being used.
* @param binRoot relative <i>root</i> path for <code>binBasenames</code>
* @param binBasename basename w/o path or suffix relative to <code>binRoot</code> for the shader's binary code
+ * @param binSuffixOpt optional custom suffix for shader's binary file,
+ * if {@code null} {@link #getFileSuffix(boolean, int)} is being used.
* @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
* which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
@@ -389,7 +475,7 @@ public class ShaderCode {
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
*
- * @throws IllegalArgumentException if <code>count</count> and <code>srcBasenames.length</code> do not match
+ * @throws IllegalArgumentException if <code>count</code> and <code>srcBasenames.length</code> do not match
*
* @see #create(GL2ES2, int, int, Class, String[])
* @see #create(int, int, Class, int, String)
@@ -397,9 +483,12 @@ public class ShaderCode {
* @see #getFileSuffix(boolean, int)
* @see ShaderUtil#getShaderBinaryFormats(GL)
* @see #getBinarySubPath(int)
+ *
+ * @since 2.3.2
*/
public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context,
- final String srcRoot, final String[] srcBasenames, final String binRoot, final String binBasename,
+ final String srcRoot, final String[] srcBasenames, final String srcSuffixOpt,
+ final String binRoot, final String binBasename, final String binSuffixOpt,
final boolean mutableStringBuilder) {
ShaderCode res = null;
final String srcPath[];
@@ -408,7 +497,7 @@ public class ShaderCode {
if( null!=srcBasenames && ShaderUtil.isShaderCompilerAvailable(gl) ) {
srcPath = new String[srcBasenames.length];
- final String srcSuffix = getFileSuffix(false, type);
+ final String srcSuffix = null != srcSuffixOpt ? srcSuffixOpt : getFileSuffix(false, type);
if( null != srcRoot && srcRoot.length() > 0 ) {
for(int i=0; i<srcPath.length; i++) {
srcPath[i] = srcRoot + '/' + srcBasenames[i] + "." + srcSuffix;
@@ -428,7 +517,7 @@ public class ShaderCode {
}
if( null!=binBasename ) {
final Set<Integer> binFmts = ShaderUtil.getShaderBinaryFormats(gl);
- final String binSuffix = getFileSuffix(true, type);
+ final String binSuffix = null != binSuffixOpt ? binSuffixOpt : getFileSuffix(true, type);
for(final Iterator<Integer> iter=binFmts.iterator(); iter.hasNext(); ) {
final int bFmt = iter.next().intValue();
final String bFmtPath = getBinarySubPath(bFmt);
@@ -445,7 +534,95 @@ public class ShaderCode {
}
/**
- * Simplified variation of {@link #create(GL2ES2, int, int, Class, String, String[], String, String, boolean)}.
+ * Simplified variation of {@link #create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean)}.
+ * <p>
+ * Convenient creation method for instantiating a complete {@link ShaderCode} object
+ * either from source code using {@link #create(GL2ES2, int, int, Class, String[])},
+ * or from a binary code using {@link #create(int, int, Class, int, String)},
+ * whatever is available first.
+ * </p>
+ * <p>
+ * The source and binary location names are expected w/o suffixes which are
+ * resolved and appended using {@link #getFileSuffix(boolean, int)}.
+ * </p>
+ * <p>
+ * Additionally, the binary resource is expected within a subfolder of <code>binRoot</code>
+ * which reflects the vendor specific binary format, see {@link #getBinarySubPath(int)}.
+ * All {@link ShaderUtil#getShaderBinaryFormats(GL)} are being iterated
+ * using the binary subfolder, the first existing resource is being used.
+ * </p>
+ *
+ * Example:
+ * <pre>
+ * Your std JVM layout (plain or within a JAR):
+ *
+ * org/test/glsl/MyShaderTest.class
+ * org/test/glsl/shader/vertex.vp
+ * org/test/glsl/shader/fragment.fp
+ * org/test/glsl/shader/bin/nvidia/vertex.bvp
+ * org/test/glsl/shader/bin/nvidia/fragment.bfp
+ *
+ * Your Android APK layout:
+ *
+ * classes.dex
+ * assets/org/test/glsl/shader/vertex.vp
+ * assets/org/test/glsl/shader/fragment.fp
+ * assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
+ * assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
+ * ...
+ *
+ * Your invocation in org/test/glsl/MyShaderTest.java:
+ *
+ * ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(),
+ * "shader", new String[] { "vertex" }, "shader/bin", "vertex", true);
+ * ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(),
+ * "shader", new String[] { "vertex" }, "shader/bin", "fragment", true);
+ * ShaderProgram sp0 = new ShaderProgram();
+ * sp0.add(gl, vp0, System.err);
+ * sp0.add(gl, fp0, System.err);
+ * st.attachShaderProgram(gl, sp0, true);
+ * </pre>
+ * A simplified entry point is {@link #create(GL2ES2, int, Class, String, String, String, boolean)}.
+ *
+ * <p>
+ * The location is finally being resolved using the <code>context</code> class, see {@link #readShaderBinary(Class, String)}.
+ * </p>
+ *
+ * @param gl current GL object to determine whether a shader compiler is available (if <code>source</code> is used),
+ * or to determine the shader binary format (if <code>binary</code> is used).
+ * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER}, {@link GL3#GL_GEOMETRY_SHADER},
+ * {@link GL4#GL_TESS_CONTROL_SHADER} or {@link GL4#GL_TESS_EVALUATION_SHADER}.
+ * @param count number of shaders
+ * @param context class used to help resolving the source and binary location
+ * @param srcRoot relative <i>root</i> path for <code>srcBasenames</code> optional
+ * @param srcBasenames basenames w/o path or suffix relative to <code>srcRoot</code> for the shader's source code
+ * @param binRoot relative <i>root</i> path for <code>binBasenames</code>
+ * @param binBasename basename w/o path or suffix relative to <code>binRoot</code> for the shader's binary code
+ * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
+ * which can be edited later on at the costs of a String conversion when passing to
+ * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
+ * If <code>false</code> method returns an immutable <code>String</code> instance,
+ * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
+ * at no additional costs.
+ *
+ * @throws IllegalArgumentException if <code>count</code> and <code>srcBasenames.length</code> do not match
+ *
+ * @see #create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean)
+ * @see #readShaderSource(Class, String)
+ * @see #getFileSuffix(boolean, int)
+ * @see ShaderUtil#getShaderBinaryFormats(GL)
+ * @see #getBinarySubPath(int)
+ */
+ public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context,
+ final String srcRoot, final String[] srcBasenames,
+ final String binRoot, final String binBasename,
+ final boolean mutableStringBuilder) {
+ return create(gl, type, count, context, srcRoot, srcBasenames, null,
+ binRoot, binBasename, null, mutableStringBuilder);
+ }
+
+ /**
+ * Simplified variation of {@link #create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean)}.
* <p>
* Example:
* <pre>
@@ -469,9 +646,76 @@ public class ShaderCode {
* Your invocation in org/test/glsl/MyShaderTest.java:
*
* ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
- * "shader", "shader/bin", "vertex");
+ * "shader", "shader/bin", "vertex", null, null, true);
* ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
- * "shader", "shader/bin", "fragment");
+ * "shader", "shader/bin", "fragment", null, null, true);
+ * ShaderProgram sp0 = new ShaderProgram();
+ * sp0.add(gl, vp0, System.err);
+ * sp0.add(gl, fp0, System.err);
+ * st.attachShaderProgram(gl, sp0, true);
+ * </pre>
+ * </p>
+ *
+ * @param gl current GL object to determine whether a shader compiler is available (if <code>source</code> is used),
+ * or to determine the shader binary format (if <code>binary</code> is used).
+ * @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER}, {@link GL3#GL_GEOMETRY_SHADER},
+ * {@link GL4#GL_TESS_CONTROL_SHADER} or {@link GL4#GL_TESS_EVALUATION_SHADER}.
+ * @param context class used to help resolving the source and binary location
+ * @param srcRoot relative <i>root</i> path for <code>basename</code> optional
+ * @param binRoot relative <i>root</i> path for <code>basename</code>
+ * @param basename basename w/o path or suffix relative to <code>srcRoot</code> and <code>binRoot</code>
+ * for the shader's source and binary code.
+ * @param srcSuffixOpt optional custom suffix for shader's source file,
+ * if {@code null} {@link #getFileSuffix(boolean, int)} is being used.
+ * @param binSuffixOpt optional custom suffix for shader's binary file,
+ * if {@code null} {@link #getFileSuffix(boolean, int)} is being used.
+ * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
+ * which can be edited later on at the costs of a String conversion when passing to
+ * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
+ * If <code>false</code> method returns an immutable <code>String</code> instance,
+ * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
+ * at no additional costs.
+ * @throws IllegalArgumentException if <code>count</code> is not 1
+ *
+ * @see #create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean)
+ * @since 2.3.2
+ */
+ public static ShaderCode create(final GL2ES2 gl, final int type, final Class<?> context,
+ final String srcRoot, final String binRoot,
+ final String basename, final String srcSuffixOpt, final String binSuffixOpt,
+ final boolean mutableStringBuilder) {
+ return create(gl, type, 1, context, srcRoot, new String[] { basename }, srcSuffixOpt,
+ binRoot, basename, binSuffixOpt, mutableStringBuilder );
+ }
+
+ /**
+ * Simplified variation of {@link #create(GL2ES2, int, Class, String, String, String, String, String, boolean)}.
+ * <p>
+ * Example:
+ * <pre>
+ * Your std JVM layout (plain or within a JAR):
+ *
+ * org/test/glsl/MyShaderTest.class
+ * org/test/glsl/shader/vertex.vp
+ * org/test/glsl/shader/fragment.fp
+ * org/test/glsl/shader/bin/nvidia/vertex.bvp
+ * org/test/glsl/shader/bin/nvidia/fragment.bfp
+ *
+ * Your Android APK layout:
+ *
+ * classes.dex
+ * assets/org/test/glsl/shader/vertex.vp
+ * assets/org/test/glsl/shader/fragment.fp
+ * assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
+ * assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
+ * ...
+ *
+ * Your invocation in org/test/glsl/MyShaderTest.java:
+ *
+ * ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
+ * "shader", "shader/bin", "vertex", true);
+ * ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
+ * "shader", "shader/bin", "fragment", true);
* ShaderProgram sp0 = new ShaderProgram();
* sp0.add(gl, vp0, System.err);
* sp0.add(gl, fp0, System.err);
@@ -495,13 +739,12 @@ public class ShaderCode {
* If <code>false</code> method returns an immutable <code>String</code> instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
- * @throws IllegalArgumentException if <code>count</count> is not 1
- *
- * @see #create(GL2ES2, int, int, Class, String, String[], String, String)
+ * @throws IllegalArgumentException if <code>count</code> is not 1
*/
public static ShaderCode create(final GL2ES2 gl, final int type, final Class<?> context,
- final String srcRoot, final String binRoot, final String basename, final boolean mutableStringBuilder) {
- return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder );
+ final String srcRoot, final String binRoot, final String basename,
+ final boolean mutableStringBuilder) {
+ return ShaderCode.create(gl, type, context, srcRoot, binRoot, basename, null, null, mutableStringBuilder);
}
/**
@@ -815,7 +1058,6 @@ public class ShaderCode {
}
}
- @SuppressWarnings("resource")
private static int readShaderSource(final Class<?> context, final URLConnection conn, final StringBuilder result, int lineno) throws IOException {
if(DEBUG_CODE) {
if(0 == lineno) {
@@ -858,10 +1100,11 @@ public class ShaderCode {
}
/**
+ * Reads shader source located in <code>conn</code>.
*
- * @param context
- * @param conn
- * @param result
+ * @param context class used to help resolve the source location, may be {@code null}
+ * @param conn the {@link URLConnection} of the shader source
+ * @param result {@link StringBuilder} sink for the resulting shader source code
* @throws IOException
*/
public static void readShaderSource(final Class<?> context, final URLConnection conn, final StringBuilder result) throws IOException {
@@ -899,6 +1142,28 @@ public class ShaderCode {
}
/**
+ * Reads shader source located from {@link Uri#absolute} {@link Uri} <code>sourceLocation</code>.
+ * @param sourceLocation {@link Uri} location of shader source
+ * @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
+ * which can be edited later on at the costs of a String conversion when passing to
+ * {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
+ * If <code>false</code> method returns an immutable <code>String</code> instance,
+ * which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
+ * at no additional costs.
+ * @throws IOException
+ * @since 2.3.2
+ */
+ public static CharSequence readShaderSource(final Uri sourceLocation, final boolean mutableStringBuilder) throws IOException {
+ final URLConnection conn = IOUtil.openURL(sourceLocation.toURL(), "ShaderCode ");
+ if (conn == null) {
+ return null;
+ }
+ final StringBuilder result = new StringBuilder();
+ readShaderSource(null, conn, result);
+ return mutableStringBuilder ? result : result.toString();
+ }
+
+ /**
* Reads shader binary located in <code>path</code>,
* either relative to the <code>context</code> class or absolute <i>as-is</i>.
* <p>
@@ -925,6 +1190,25 @@ public class ShaderCode {
}
}
+ /**
+ * Reads shader binary located from {@link Uri#absolute} {@link Uri} <code>binLocation</code>.
+ * @param binLocation {@link Uri} location of shader binary
+ * @throws IOException
+ * @since 2.3.2
+ */
+ public static ByteBuffer readShaderBinary(final Uri binLocation) throws IOException {
+ final URLConnection conn = IOUtil.openURL(binLocation.toURL(), "ShaderCode ");
+ if (conn == null) {
+ return null;
+ }
+ final BufferedInputStream bis = new BufferedInputStream( conn.getInputStream() );
+ try {
+ return IOUtil.copyStream2ByteBuffer( bis );
+ } finally {
+ IOUtil.close(bis, false);
+ }
+ }
+
// Shall we use: #ifdef GL_FRAGMENT_PRECISION_HIGH .. #endif for using highp in fragment shader if avail ?
/** Default precision of {@link GL#isGLES2() ES2} for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader}: {@value #es2_default_precision_vp} */
public static final String es2_default_precision_vp = "\nprecision highp float;\nprecision highp int;\n/*precision lowp sampler2D;*/\n/*precision lowp samplerCube;*/\n";
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java
index 075da340b..43a6cfc58 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/EyeParameter.java
@@ -30,7 +30,7 @@ package com.jogamp.opengl.util.stereo;
import com.jogamp.opengl.math.FovHVHalves;
/**
- * Constant parameter for one eye.
+ * Constant single eye parameter of the viewer, relative to its {@link ViewerPose}.
*/
public final class EyeParameter {
/** Eye number, <code>0</code> for the left eye and <code>1</code> for the right eye. */
@@ -39,7 +39,7 @@ public final class EyeParameter {
/** float[3] eye position vector used to define eye height in meter relative to <i>actor</i>. */
public final float[] positionOffset;
- /** Field of view in both directions, may not be centered, either in radians or tangent. */
+ /** Field of view in both directions, may not be centered, either {@link FovHVHalves#inTangents} or radians. */
public final FovHVHalves fovhv;
/** IPD related horizontal distance from nose to pupil in meter. */
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/LocationSensorParameter.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/LocationSensorParameter.java
new file mode 100644
index 000000000..b795927cd
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/LocationSensorParameter.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2015 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.util.stereo;
+
+import com.jogamp.opengl.math.geom.Frustum;
+
+/**
+ * Constant parameter of the positioning sensor to locate the {@link ViewerPose}.
+ */
+public final class LocationSensorParameter {
+ /** The {@link Frustum} of the location sensor. */
+ public final Frustum frustum;
+ /** The {@link Frustum}'s {@link Frustum.FovDesc} description of the location sensor. */
+ public final Frustum.FovDesc frustumDesc;
+ /** The {@link Frustum}'s float[16] projection matrix of the location sensor. */
+ public final float[] frustumProjMat;
+
+ public LocationSensorParameter(final Frustum.FovDesc fovDesc) {
+ this.frustumDesc = fovDesc;
+ this.frustum = new Frustum();
+ this.frustumProjMat = frustum.updateByFovDesc(new float[16], 0, true, fovDesc);
+ }
+ public final String toString() {
+ return "LocationSensor["+frustumDesc+"]";
+ }
+} \ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java
index b1a38ab06..8ecd8b8f7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java
@@ -189,10 +189,7 @@ public class StereoClientRenderer implements GLEventListener {
final int[] eyeOrder = deviceRenderer.getDevice().getEyeRenderOrder();
final int eyeCount = eyeOrder.length;
- // Update eye pos upfront to have same (almost) results
- for(int eyeNum=0; eyeNum<eyeCount; eyeNum++) {
- deviceRenderer.updateEyePose(eyeNum);
- }
+ final ViewerPose viewerPose = deviceRenderer.updateViewerPose();
if( 1 == fboCount ) {
fbos[0].bind(gl);
@@ -213,7 +210,7 @@ public class StereoClientRenderer implements GLEventListener {
public void run(final GLAutoDrawable drawable, final GLEventListener listener) {
final StereoGLEventListener sl = (StereoGLEventListener) listener;
sl.reshapeForEye(drawable, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight(),
- eye.getEyeParameter(), eye.getLastEyePose());
+ eye.getEyeParameter(), viewerPose);
sl.display(drawable, displayFlags);
} };
helper.runForAllGLEventListener(drawable, reshapeDisplayAction);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java
index d59863530..b6112650a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java
@@ -41,10 +41,30 @@ public interface StereoDevice {
public static final boolean DEBUG = Debug.debug("StereoDevice");
public static final boolean DUMP_DATA = Debug.isPropertyDefined("jogl.debug.StereoDevice.DumpData", true);
+ /**
+ * Sensor Bit: Orientation tracking
+ */
+ public static final int SENSOR_ORIENTATION = 1 << 0;
+
+ /**
+ * Sensor Bit: Yaw correction
+ */
+ public static final int SENSOR_YAW_CORRECTION = 1 << 1;
+
+ /**
+ * Sensor Bit: Positional tracking
+ */
+ public static final int SENSOR_POSITION = 1 << 2;
+
/** Return the factory used to create this device. */
public StereoDeviceFactory getFactory();
- /** Disposes this {@link StereoDevice}, if {@link #isValid() valid}. */
+ /**
+ * Disposes this {@link StereoDevice}, if {@link #isValid() valid}.
+ * <p>
+ * Implementation shall {@link #stopSensors() stop sensors} and free all resources.
+ * </p>
+ */
public void dispose();
/**
@@ -96,13 +116,76 @@ public interface StereoDevice {
*/
public FovHVHalves[] getDefaultFOV();
- /** Start or stop sensors. Returns true if action was successful, otherwise false. */
- public boolean startSensors(boolean start);
+ /**
+ * Returns the {@link LocationSensorParameter} of the device
+ * if {@link #SENSOR_POSITION} is {@link #getSupportedSensorBits() supported},
+ * otherwise returns {@code null}.
+ */
+ public LocationSensorParameter getLocationSensorParams();
- /** Return true if sensors have been started, false otherwise */
+
+ /**
+ * Sets the location sensor's origin of this device to the current position.
+ * <p>
+ * In case {@link #SENSOR_POSITION} is not {@link #getSupportedSensorBits() supported},
+ * this method is a no-op.
+ * </p>
+ */
+ public void resetLocationSensorOrigin();
+
+ /**
+ * Start desired and required sensors. Returns true if action was successful, otherwise false.
+ * <p>
+ * Method fails if required sensors are not {@link #getSupportedSensorBits() supported}.
+ * </p>
+ * @param desiredSensorBits the desired optional sensors
+ * @param requiredSensorBits the required sensors
+ * @see #stopSensors()
+ * @see #getSensorsStarted()
+ * @see #getSupportedSensorBits()
+ * @see #getEnabledSensorBits()
+ */
+ public boolean startSensors(int desiredSensorBits, int requiredSensorBits);
+
+ /**
+ * Stop sensors. Returns true if action was successful, otherwise false.
+ * @see #startSensors(int, int)
+ * @see #getSensorsStarted()
+ * @see #getSupportedSensorBits()
+ * @see #getEnabledSensorBits()
+ */
+ public boolean stopSensors();
+
+ /**
+ * Return true if sensors have been started, false otherwise.
+ * @see #startSensors(int, int)
+ * @see #stopSensors()
+ * @see #getSupportedSensorBits()
+ * @see #getEnabledSensorBits()
+ */
public boolean getSensorsStarted();
/**
+ * Returns the supported sensor capability bits, e.g. {@link #SENSOR_ORIENTATION}, {@link #SENSOR_POSITION}
+ * of the {@link StereoDevice}.
+ * @see #startSensors(int, int)
+ * @see #stopSensors()
+ * @see #getSensorsStarted()
+ * @see #getEnabledSensorBits()
+ */
+ public int getSupportedSensorBits();
+
+ /**
+ * Returns the actual used sensor capability bits, e.g. {@link #SENSOR_ORIENTATION}, {@link #SENSOR_POSITION}
+ * in case the {@link #getSupportedSensorBits() device supports} them and if they are enabled.
+ * @see #startSensors(int, int)
+ * @see #stopSensors()
+ * @see #getSensorsStarted()
+ * @see #getSupportedSensorBits()
+ */
+ public int getEnabledSensorBits();
+
+ /**
* Returns an array of the preferred eye rendering order.
* The array length reflects the supported eye count.
* <p>
@@ -112,7 +195,7 @@ public interface StereoDevice {
public int[] getEyeRenderOrder();
/**
- * Returns the supported distortion compensation by the {@link StereoDeviceRenderer},
+ * Returns the supported distortion compensation of the {@link StereoDeviceRenderer},
* e.g. {@link StereoDeviceRenderer#DISTORTION_BARREL}, {@link StereoDeviceRenderer#DISTORTION_CHROMATIC}, etc.
* @see StereoDeviceRenderer#getDistortionBits()
* @see #createRenderer(int, int, float[], FovHVHalves[], float, int)
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java
index 2078a00a2..0d6539634 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java
@@ -42,10 +42,10 @@ import com.jogamp.opengl.math.FovHVHalves;
* <ul>
* <li>device.{@link #beginFrame(GL)}</li>
* <li>For both eyes:<ul>
- * <li>device.{@link #updateEyePose(int)}</li>
+ * <li>device.{@link #updateViewerPose(int)}</li>
* <li>if device.{@link #ppAvailable()}: Set the render target, e.g. FBO</li>
* <li>Set the viewport using {@link Eye#getViewport()}</li>
- * <li>{@link StereoGLEventListener#reshapeForEye(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream.reshapeEye(..)}</li>
+ * <li>{@link StereoGLEventListener#reshapeForEye(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, ViewerPose) upstream.reshapeEye(..)}</li>
* <li>{@link StereoGLEventListener#display(com.jogamp.opengl.GLAutoDrawable, int) upstream.display(..)}.</li>
* </ul></li>
* <li>Reset the viewport</li>
@@ -89,7 +89,7 @@ public interface StereoDeviceRenderer {
/**
* Distortion Bit: Timewarp distortion technique to predict
- * {@link EyePose} movement to reduce latency.
+ * {@link ViewerPose} movement to reduce latency.
* <p>
* FIXME: Explanation needs refinement!
* </p>
@@ -113,10 +113,6 @@ public interface StereoDeviceRenderer {
* Returns the {@link EyeParameter} of this eye.
*/
public EyeParameter getEyeParameter();
- /**
- * Returns the last {@link EyePose} of this eye.
- */
- public EyePose getLastEyePose();
}
/**
@@ -125,10 +121,14 @@ public interface StereoDeviceRenderer {
public Eye getEye(final int eyeNum);
/**
- * Updates the {@link Eye#getLastEyePose()}
- * for the denoted <code>eyeNum</code>.
+ * Updates the {@link ViewerPose} and returns it.
+ */
+ public ViewerPose updateViewerPose();
+
+ /**
+ * Returns the last {@link ViewerPose}.
*/
- public EyePose updateEyePose(final int eyeNum);
+ public ViewerPose getLastViewerPose();
/**
* Returns used distortion compensation bits, e.g. {@link #DISTORTION_BARREL},
@@ -219,7 +219,7 @@ public interface StereoDeviceRenderer {
/**
* Begin stereoscopic post-processing, see {@link #ppAvailable()}.
* <p>
- * {@link #updateEyePose(int)} for both eyes must be called upfront
+ * {@link #updateViewerPose(int)} for both eyes must be called upfront
* when rendering upstream {@link StereoGLEventListener}.
* </p>
*
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java
index c1a06796c..59f38f2af 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java
@@ -51,7 +51,7 @@ public interface StereoGLEventListener extends CustomGLEventListener {
* </p>
* <p>
* The client shall also update it's projection- and modelview matrices according
- * to the given {@link EyeParameter} and {@link EyePose}.
+ * to the given {@link EyeParameter} and {@link ViewerPose}.
* </p>
* <p>
* For efficiency the GL viewport has already been updated
@@ -64,11 +64,11 @@ public interface StereoGLEventListener extends CustomGLEventListener {
* @param width viewport width in pixel units
* @param height viewport height in pixel units
* @param eyeParam constant eye parameter, i.e. FOV and IPD
- * @param eyePose current eye position and orientation
+ * @param viewerPose current viewer position and orientation
* @see FloatUtil#makePerspective(float[], int, boolean, com.jogamp.opengl.math.FloatUtil.FovHVHalves, float, float)
*/
public void reshapeForEye(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height,
- final EyeParameter eyeParam, final EyePose eyePose);
+ final EyeParameter eyeParam, final ViewerPose viewerPose);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java
index b0ca4ddb2..b6f76a343 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java
@@ -97,23 +97,51 @@ public class StereoUtil {
return sb.toString();
}
+ /** See {@link StereoDevice#getSupportedSensorBits()} and {@link StereoDevice#getEnabledSensorBits()}. */
+ public static boolean usesOrientationSensor(final int sensorBits) { return 0 != ( sensorBits & StereoDevice.SENSOR_ORIENTATION ) ; }
+ /** See {@link StereoDevice#getSupportedSensorBits()} and {@link StereoDevice#getEnabledSensorBits()}. */
+ public static boolean usesYawCorrectionSensor(final int sensorBits) { return 0 != ( sensorBits & StereoDevice.SENSOR_YAW_CORRECTION ) ; }
+ /** See {@link StereoDevice#getSupportedSensorBits()} and {@link StereoDevice#getEnabledSensorBits()}. */
+ public static boolean usesPositionSensor(final int sensorBits) { return 0 != ( sensorBits & StereoDevice.SENSOR_POSITION ) ; }
+
+ /** See {@link StereoDevice#getSupportedSensorBits()} and {@link StereoDevice#getEnabledSensorBits()}. */
+ public static String sensorBitsToString(final int sensorBits) {
+ boolean appendComma = false;
+ final StringBuilder sb = new StringBuilder();
+ if( usesOrientationSensor(sensorBits) ) {
+ if( appendComma ) { sb.append(", "); };
+ sb.append("orientation"); appendComma=true;
+ }
+ if( usesYawCorrectionSensor(sensorBits) ) {
+ if( appendComma ) { sb.append(", "); };
+ sb.append("yaw-corr"); appendComma=true;
+ }
+ if( usesPositionSensor(sensorBits) ) {
+ if( appendComma ) { sb.append(", "); };
+ sb.append("position"); appendComma=true;
+ }
+ return sb.toString();
+ }
+
/**
* Calculates the <i>Side By Side</i>, SBS, projection- and modelview matrix for one eye.
* <p>
- * {@link #updateEyePose(int)} must be called upfront.
+ * {@link #updateViewerPose(int)} must be called upfront.
* </p>
* <p>
* This method merely exist as an example implementation to compute the matrices,
* which shall be adopted by the
- * {@link CustomGLEventListener#reshape(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream client code}.
+ * {@link CustomGLEventListener#reshape(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, ViewerPose) upstream client code}.
* </p>
- * @param eyeNum eye denominator
+ * @param viewerPose
+ * @param eye
* @param zNear frustum near value
* @param zFar frustum far value
* @param mat4Projection float[16] projection matrix result
* @param mat4Modelview float[16] modelview matrix result
*/
- public static void getSBSUpstreamPMV(final Eye eye, final float zNear, final float zFar,
+ public static void getSBSUpstreamPMV(final ViewerPose viewerPose, final Eye eye,
+ final float zNear, final float zFar,
final float[] mat4Projection, final float[] mat4Modelview) {
final float[] mat4Tmp1 = new float[16];
final float[] mat4Tmp2 = new float[16];
@@ -122,7 +150,6 @@ public class StereoUtil {
final float[] vec3Tmp3 = new float[3];
final EyeParameter eyeParam = eye.getEyeParameter();
- final EyePose eyePose = eye.getLastEyePose();
//
// Projection
@@ -135,10 +162,10 @@ public class StereoUtil {
final Quaternion rollPitchYaw = new Quaternion();
// private final float eyeYaw = FloatUtil.PI; // 180 degrees in radians
// rollPitchYaw.rotateByAngleY(eyeYaw);
- final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, eyePose.position, 0);
+ final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, viewerPose.position, 0);
VectorUtil.addVec3(shiftedEyePos, shiftedEyePos, eyeParam.positionOffset);
- rollPitchYaw.mult(eyePose.orientation);
+ rollPitchYaw.mult(viewerPose.orientation);
final float[] up = rollPitchYaw.rotateVector(vec3Tmp2, 0, VectorUtil.VEC3_UNIT_Y, 0);
final float[] forward = rollPitchYaw.rotateVector(vec3Tmp3, 0, VectorUtil.VEC3_UNIT_Z_NEG, 0);
final float[] center = VectorUtil.addVec3(forward, shiftedEyePos, forward);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/EyePose.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java
index aa64ff130..10ee4c994 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/EyePose.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/ViewerPose.java
@@ -30,29 +30,34 @@ package com.jogamp.opengl.util.stereo;
import com.jogamp.opengl.math.Quaternion;
/**
- * Position and orientation of one eye.
+ * {@link #position} and {@link #orientation} of viewer.
*/
-public final class EyePose {
- /** Eye number, <code>0</code> for the left eye and <code>1</code> for the right eye. */
- public final int number;
-
- /** float[3] eye position vector. */
+public final class ViewerPose {
+ /**
+ * float[3] position of viewer in meter.
+ * <p>
+ * Apply the following to resolve the actual eye position:
+ * <ul>
+ * <li>{@link EyeParameter#positionOffset positionOffset} for head.</li>
+ * <li>[{@link EyeParameter#distNoseToPupilX distNoseToPupilX}, {@link EyeParameter#distMiddleToPupilY distMiddleToPupilY}, {@link EyeParameter#eyeReliefZ eyeReliefZ}] for pupil</li>
+ * </ul>
+ * </p>
+ */
public final float[] position;
- /** Eye orientation */
+ /** Orientation of viewer. */
public final Quaternion orientation;
- public EyePose(final int number) {
- this.number = number;
+ public ViewerPose() {
this.position = new float[3];
this.orientation = new Quaternion();
}
- public EyePose(final int number, final float[] position, final Quaternion orientation) {
- this(number);
+ public ViewerPose(final float[] position, final Quaternion orientation) {
+ this();
set(position, orientation);
}
- /** Set position and orientation of this instance. */
+ /** Set {@link #position} and {@link #orientation}. */
public final void set(final float[] position, final Quaternion orientation) {
System.arraycopy(position, 0, this.position, 0, 3);
this.orientation.set(orientation);
@@ -64,6 +69,6 @@ public final class EyePose {
position[2] = posZ;
}
public final String toString() {
- return "EyePose[num "+number+", pos["+position[0]+", "+position[1]+", "+position[2]+"], "+orientation+"]";
+ return "ViewerPose[pos["+position[0]+", "+position[1]+", "+position[2]+"], "+orientation+"]";
}
} \ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceConfig.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceConfig.java
index 04fd8343c..44129de02 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceConfig.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceConfig.java
@@ -37,6 +37,7 @@ import com.jogamp.opengl.util.stereo.EyeParameter;
import com.jogamp.opengl.util.stereo.StereoDeviceConfig;
import com.jogamp.opengl.util.stereo.StereoDeviceRenderer;
import com.jogamp.opengl.util.stereo.StereoUtil;
+import com.jogamp.opengl.util.stereo.StereoDevice;
/**
* Configuration for {@link GenericStereoDevice}s.
@@ -54,6 +55,7 @@ public class GenericStereoDeviceConfig extends StereoDeviceConfig {
final float interpupillaryDistanceInMeters,
final int[] eyeRenderOrder,
final EyeParameter[] defaultEyeParam,
+ final int supportedSensorBits,
final DistortionMesh.Producer distortionMeshProducer,
final int supportedDistortionBits,
final int recommendedDistortionBits,
@@ -71,6 +73,7 @@ public class GenericStereoDeviceConfig extends StereoDeviceConfig {
this.interpupillaryDistanceInMeters = interpupillaryDistanceInMeters;
this.eyeRenderOrder = eyeRenderOrder;
this.defaultEyeParam = defaultEyeParam;
+ this.supportedSensorBits = supportedSensorBits;
this.distortionMeshProducer = distortionMeshProducer;
this.supportedDistortionBits = supportedDistortionBits;
this.recommendedDistortionBits = recommendedDistortionBits;
@@ -92,6 +95,7 @@ public class GenericStereoDeviceConfig extends StereoDeviceConfig {
this.interpupillaryDistanceInMeters = source.interpupillaryDistanceInMeters;
this.eyeRenderOrder = source.eyeRenderOrder;
this.defaultEyeParam = source.defaultEyeParam;
+ this.supportedSensorBits = source.supportedSensorBits;
this.distortionMeshProducer = source.distortionMeshProducer;
this.supportedDistortionBits = source.supportedDistortionBits;
this.recommendedDistortionBits = source.recommendedDistortionBits;
@@ -141,7 +145,8 @@ public class GenericStereoDeviceConfig extends StereoDeviceConfig {
" [m], eyeParam "+Arrays.toString(defaultEyeParam)+
", distortionBits[supported ["+StereoUtil.distortionBitsToString(supportedDistortionBits)+
"], recommended ["+StereoUtil.distortionBitsToString(recommendedDistortionBits)+
- "], minimum ["+StereoUtil.distortionBitsToString(minimumDistortionBits)+"]]]";
+ "], minimum ["+StereoUtil.distortionBitsToString(minimumDistortionBits)+"]]"+
+ ", sensorBits[supported ["+StereoUtil.sensorBitsToString(supportedSensorBits)+"]]]";
}
/** Configuration Name */
@@ -164,9 +169,13 @@ public class GenericStereoDeviceConfig extends StereoDeviceConfig {
public final float[/*per-eye*/][/*xy*/] pupilCenterFromTopLeft;
public final int[] eyeRenderOrder;
public final EyeParameter[] defaultEyeParam;
+
+ /** Supported sensor bits, see {@link StereoDevice#SENSOR_ORIENTATION}. */
+ public final int supportedSensorBits;
+
public final DistortionMesh.Producer distortionMeshProducer;
- /** Supported distortion bits, see {@link StereoDeviceRenderer.DISTORTION_BARREL}. */
+ /** Supported distortion bits, see {@link StereoDeviceRenderer#DISTORTION_BARREL}. */
public final int supportedDistortionBits;
/** Recommended distortion bits, see {@link StereoDeviceRenderer.DISTORTION_BARREL}. */
public final int recommendedDistortionBits;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceFactory.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceFactory.java
index 6adb96ba4..957758e78 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/generic/GenericStereoDeviceFactory.java
@@ -70,6 +70,7 @@ public class GenericStereoDeviceFactory extends StereoDeviceFactory {
// degrees: 45/2 l, 45/2 r, 45/2 * aspect t, 45/2 * aspect b
FovHVHalves.byFovyRadianAndAspect(45f*d2r, 1280f / 800f),
0f /* distNoseToPupil */, 0f /* verticalDelta */, 0f /* eyeReliefInMeters */) },
+ 0, // supported sensor bits
null, // mash producer distortion bits
0, // supported distortion bits
0, // recommended distortion bits
@@ -114,6 +115,7 @@ public class GenericStereoDeviceFactory extends StereoDeviceFactory {
interpupillaryDistanceInMeters/2f /* distNoseToPupil */, 0f /* verticalDelta */, 0.010f /* eyeReliefInMeters */),
new EyeParameter(1, defaultEyePositionOffset, defaultSBSEyeFovRight,
-interpupillaryDistanceInMeters/2f /* distNoseToPupil */, 0f /* verticalDelta */, 0.010f /* eyeReliefInMeters */) },
+ 0, // supported sensor bits
null, // mash producer distortion bits
0, // supported distortion bits
0, // recommended distortion bits
@@ -171,6 +173,7 @@ public class GenericStereoDeviceFactory extends StereoDeviceFactory {
interpupillaryDistanceInMeters/2f /* distNoseToPupil */, 0f /* verticalDelta */, 0.010f /* eyeReliefInMeters */),
new EyeParameter(1, defaultEyePositionOffset, defaultSBSEyeFovRight,
-interpupillaryDistanceInMeters/2f /* distNoseToPupil */, 0f /* verticalDelta */, 0.010f /* eyeReliefInMeters */) },
+ 0, // supported sensor bits
lenseDistMeshProduce,
// supported distortion bits
StereoDeviceRenderer.DISTORTION_BARREL | StereoDeviceRenderer.DISTORTION_CHROMATIC | StereoDeviceRenderer.DISTORTION_VIGNETTE,
diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
index ee9560214..5ec5a8e3f 100644
--- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java
+++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
@@ -170,7 +170,8 @@ public class ProjectFloat {
* @param aspect
* @param zNear
* @param zFar
- * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
+ * @throws GLException if {@code zNear <= 0} or {@code zFar <= zNear}
+ * @see FloatUtil#makePerspective(float[], int, boolean, float, float, float, float)
*/
public void gluPerspective(final GLMatrixFunc gl, final float fovy_deg, final float aspect, final float zNear, final float zFar) throws GLException {
gl.glMultMatrixf(FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0);
diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
index 9c0a5045b..bfe93b59c 100644
--- a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
+++ b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
@@ -36,9 +36,11 @@ import com.jogamp.nativewindow.util.RectangleImmutable;
import com.jogamp.opengl.math.FovHVHalves;
import com.jogamp.opengl.util.stereo.StereoDeviceConfig;
import com.jogamp.opengl.util.stereo.EyeParameter;
+import com.jogamp.opengl.util.stereo.LocationSensorParameter;
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;
import com.jogamp.opengl.util.stereo.generic.GenericStereoDeviceConfig;
import com.jogamp.opengl.util.stereo.generic.GenericStereoDeviceFactory;
@@ -117,6 +119,7 @@ public class GenericStereoDevice implements StereoDevice {
public final Point surfacePos;
private final FovHVHalves[] defaultEyeFov;
+ private int usedSensorBits;
private boolean sensorsStarted = false;
public GenericStereoDevice(final StereoDeviceFactory factory, final int deviceIndex, final StereoDeviceConfig customConfig) {
@@ -137,6 +140,9 @@ public class GenericStereoDevice implements StereoDevice {
for(int i=0; i<defaultEyeFov.length; i++) {
defaultEyeFov[i] = config.defaultEyeParam[i].fovhv;
}
+
+ // default
+ usedSensorBits = 0;
}
@Override
@@ -144,7 +150,8 @@ public class GenericStereoDevice implements StereoDevice {
@Override
public String toString() {
- return "GenericStereoDevice["+config+", surfacePos "+surfacePos+"]";
+ return "GenericStereoDevice["+config+", surfacePos "+surfacePos+
+ ", sensorBits[enabled ["+StereoUtil.sensorBitsToString(getEnabledSensorBits())+"]]]";
}
public void setSurfacePosition(final int x, final int y) {
@@ -153,52 +160,69 @@ public class GenericStereoDevice implements StereoDevice {
@Override
public final void dispose() {
- // NOP
+ stopSensors();
}
@Override
- public boolean isValid() {
- return true;
- }
+ public boolean isValid() { return true; }
@Override
- public final PointImmutable getPosition() {
- return surfacePos;
- }
+ public final PointImmutable getPosition() { return surfacePos; }
@Override
- public final DimensionImmutable getSurfaceSize() {
- return config.surfaceSizeInPixels;
- }
+ public final DimensionImmutable getSurfaceSize() { return config.surfaceSizeInPixels; }
@Override
public int getRequiredRotation() { return 0; }
@Override
- public float[] getDefaultEyePositionOffset() {
- return config.defaultEyeParam[0].positionOffset;
- }
+ public float[] getDefaultEyePositionOffset() { return config.defaultEyeParam[0].positionOffset; }
@Override
- public final FovHVHalves[] getDefaultFOV() {
- return defaultEyeFov;
- }
+ public final FovHVHalves[] getDefaultFOV() { return defaultEyeFov; }
+
+ @Override
+ public final LocationSensorParameter getLocationSensorParams() { return null; }
@Override
- public final boolean startSensors(final boolean start) {
- if( start && !sensorsStarted ) {
- if( startSensorsImpl(true) ) {
+ public final void resetLocationSensorOrigin() { }
+
+ @Override
+ public final boolean startSensors(final int desiredSensorBits, final int requiredSensorBits) {
+ if( !sensorsStarted ) {
+ if( requiredSensorBits != ( config.supportedSensorBits & requiredSensorBits ) ) {
+ // required sensors not available
+ return false;
+ }
+ if( 0 == ( config.supportedSensorBits & ( requiredSensorBits | desiredSensorBits ) ) ) {
+ // no sensors available
+ return false;
+ }
+ if( startSensorsImpl(true, desiredSensorBits, requiredSensorBits) ) {
sensorsStarted = true;
return true;
} else {
- sensorsStarted = false;
return false;
}
- } else if( sensorsStarted ) {
- if( startSensorsImpl(false) ) {
+ } else {
+ // No state change -> Success
+ return true;
+ }
+ }
+ protected boolean startSensorsImpl(final boolean start, final int desiredSensorBits, final int requiredSensorBits) {
+ // TODO: Add SPI for sensors
+ // TODO: start sensors in override / or SPI
+ // TODO: set usedSensorBits
+ return false;
+ }
+
+ @Override
+ public final boolean stopSensors() {
+ if( sensorsStarted ) {
+ if( startSensorsImpl(false, 0, 0) ) {
sensorsStarted = false;
+ usedSensorBits = 0;
return true;
} else {
- sensorsStarted = true;
return false;
}
} else {
@@ -206,12 +230,21 @@ public class GenericStereoDevice implements StereoDevice {
return true;
}
}
- private boolean startSensorsImpl(final boolean start) { return start; }
@Override
public boolean getSensorsStarted() { return sensorsStarted; }
@Override
+ public final int getSupportedSensorBits() {
+ return config.supportedSensorBits;
+ }
+
+ @Override
+ public final int getEnabledSensorBits() {
+ return usedSensorBits;
+ }
+
+ @Override
public int[] getEyeRenderOrder() { return config.eyeRenderOrder; }
@Override
diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java
index 6650342e7..21567a0f1 100644
--- a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java
+++ b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java
@@ -49,7 +49,7 @@ import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.stereo.EyeParameter;
-import com.jogamp.opengl.util.stereo.EyePose;
+import com.jogamp.opengl.util.stereo.ViewerPose;
import com.jogamp.opengl.util.stereo.StereoDevice;
import com.jogamp.opengl.util.stereo.StereoDeviceRenderer;
import com.jogamp.opengl.util.stereo.StereoUtil;
@@ -82,7 +82,6 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
private final EyeParameter eyeParameter;
- private final EyePose eyePose;
@Override
public final RectangleImmutable getViewport() { return viewport; }
@@ -90,12 +89,9 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
@Override
public final EyeParameter getEyeParameter() { return eyeParameter; }
- @Override
- public final EyePose getLastEyePose() { return eyePose; }
-
- private GenericEye(final GenericStereoDevice device, final int distortionBits,
- final float[] eyePositionOffset, final EyeParameter eyeParam,
- final DimensionImmutable textureSize, final RectangleImmutable eyeViewport) {
+ /* pp */ GenericEye(final GenericStereoDevice device, final int distortionBits,
+ final float[] eyePositionOffset, final EyeParameter eyeParam,
+ final DimensionImmutable textureSize, final RectangleImmutable eyeViewport) {
this.eyeName = eyeParam.number;
this.distortionBits = distortionBits;
this.viewport = eyeViewport;
@@ -123,10 +119,6 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
this.eyeParameter = eyeParam;
- this.eyePose = new EyePose(eyeName);
-
- updateEyePose(device); // 1st init
-
// Setup: eyeToSourceUVScale, eyeToSourceUVOffset
if( usePP ) {
final ScaleAndOffset2D textureScaleAndOffset = new ScaleAndOffset2D(eyeParam.fovhv, textureSize, eyeViewport);
@@ -333,18 +325,18 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
indices.enableBuffer(gl, false);
}
- private void dispose(final GL2ES2 gl) {
+ /* pp */ void dispose(final GL2ES2 gl) {
if( null == iVBO ) return;
iVBO.destroy(gl);
indices.destroy(gl);
}
- private void enableVBO(final GL2ES2 gl, final boolean enable) {
+ /* pp */ void enableVBO(final GL2ES2 gl, final boolean enable) {
if( null == iVBO ) return;
iVBO.enableBuffer(gl, enable);
indices.bindBuffer(gl, enable); // keeps VBO binding if enable:=true
}
- private void updateUniform(final GL2ES2 gl, final ShaderProgram sp) {
+ /* pp */ void updateUniform(final GL2ES2 gl, final ShaderProgram sp) {
if( null == iVBO ) return;
gl.glUniform(eyeToSourceUVScale);
gl.glUniform(eyeToSourceUVOffset);
@@ -354,15 +346,6 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
}
}
- /**
- * Updates {@link #ovrEyePose} and it's extracted
- * {@link #eyeRenderPoseOrientation} and {@link #eyeRenderPosePosition}.
- * @param hmdCtx used get the {@link #ovrEyePose} via {@link OVR#ovrHmd_GetEyePose(OvrHmdContext, int)}
- */
- private EyePose updateEyePose(final GenericStereoDevice hmdCtx) {
- return eyePose;
- }
-
@Override
public String toString() {
final String ppTxt = null == iVBO ? ", no post-processing" :
@@ -373,12 +356,13 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
", "+eyeParameter+
", vertices "+vertexCount+", indices "+indexCount+
ppTxt+
- ", desc"+eyeParameter+", "+eyePose+"]";
+ ", desc "+eyeParameter+"]";
}
}
private final GenericStereoDevice device;
private final GenericEye[] eyes;
+ private final ViewerPose viewerPose;
private final int distortionBits;
private final int textureCount;
private final DimensionImmutable[] eyeTextureSizes;
@@ -445,9 +429,11 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
this.totalTextureSize = zeroSize;
texUnit0 = null;
}
+ viewerPose = new ViewerPose();
for(int i=0; i<eyeParam.length; i++) {
eyes[i] = new GenericEye(context, this.distortionBits, eyePositionOffset, eyeParam[i], textureSizes[i], eyeViewports[i]);
}
+
sp = null;
}
@@ -559,8 +545,14 @@ public class GenericStereoDeviceRenderer implements StereoDeviceRenderer {
}
@Override
- public final EyePose updateEyePose(final int eyeNum) {
- return eyes[eyeNum].updateEyePose(device);
+ public final ViewerPose updateViewerPose() {
+ // NOP
+ return viewerPose;
+ }
+
+ @Override
+ public final ViewerPose getLastViewerPose() {
+ return viewerPose;
}
@Override
diff --git a/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c b/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c
index 3166306ba..fc2fb6ea3 100644
--- a/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c
+++ b/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c
@@ -39,7 +39,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_opengl_util_av_impl_OMXGLMediaPlayer_init
jclass c;
if (omxGLMediaPlayerClazz != NULL) {
- return;
+ return JNI_FALSE;
}
c = (*env)->FindClass(env, ClazzNameOMXGLMediaPlayer);
diff --git a/src/jogl/native/openmax/omx_tool.h b/src/jogl/native/openmax/omx_tool.h
index 022c56cf9..31abfc5b2 100644
--- a/src/jogl/native/openmax/omx_tool.h
+++ b/src/jogl/native/openmax/omx_tool.h
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
// FIXME: Move all sync/buffer handling to Java - Already done -> GLMediaPlayerImpl
#define EGLIMAGE_MAX_BUFFERS 4
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
index b10b12128..c750f7651 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
@@ -114,9 +114,9 @@ public class SWTAccessor {
private static VersionNumber GTK_VERSION(final int version) {
// return (major << 16) + (minor << 8) + micro;
- final int micro = ( version ) & 0x0f;
- final int minor = ( version >> 8 ) & 0x0f;
- final int major = ( version >> 16 ) & 0x0f;
+ final int micro = ( version ) & 0xff;
+ final int minor = ( version >> 8 ) & 0xff;
+ final int major = ( version >> 16 ) & 0xff;
return new VersionNumber(major, minor, micro);
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java b/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java
index 24eba6ec1..3586aaa4b 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/util/stereo/StereoDeviceUtil.java
@@ -90,6 +90,8 @@ public class StereoDeviceUtil {
System.err.println("StereoDevice Set Mode: "+newMode);
monitor.setCurrentMode(newMode);
}
+ final MonitorMode queriedMode = monitor.queryCurrentMode();
+ System.err.println("StereoDevice Post-Set Mode: "+queriedMode);
} else {
System.err.println("StereoDevice Keeps Mode: "+currentMode);
}
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
index 3d3fde4d7..d111e850e 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
@@ -40,6 +40,7 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
import com.jogamp.opengl.egl.EGL;
import com.jogamp.opengl.util.PNGPixelRect;
+import com.jogamp.opengl.GLProfile;
import jogamp.newt.DisplayImpl;
import jogamp.newt.NEWTJNILibLoader;
@@ -52,6 +53,7 @@ public class DisplayDriver extends DisplayImpl {
static {
NEWTJNILibLoader.loadNEWT();
+ GLProfile.initSingleton();
if (!DisplayDriver.initIDs()) {
throw new NativeWindowException("Failed to initialize bcm.vc.iv Display jmethodIDs");
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
index 29c7f9898..93c28d370 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
@@ -37,7 +37,8 @@ import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.nativewindow.VisualIDHolder;
import com.jogamp.nativewindow.util.Insets;
import com.jogamp.nativewindow.util.Point;
-
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import com.jogamp.common.util.IntBitfield;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import com.jogamp.newt.event.MouseEvent;
@@ -63,6 +64,75 @@ public class WindowDriver extends WindowImpl {
windowHandleClose = 0;
}
+ /**
+ * Clamp given rectangle to given screen bounds.
+ *
+ * @param screen
+ * @param rect the {@link RectangleImmutable} in pixel units
+ * @param definePosSize if {@code true} issue {@link #definePosition(int, int)} and {@link #defineSize(int, int)}
+ * if either has changed.
+ * @return If position or size has been clamped a new {@link RectangleImmutable} instance w/ clamped values
+ * will be returned, otherwise the given {@code rect} is returned.
+ */
+ private RectangleImmutable clampRect(final ScreenDriver screen, final RectangleImmutable rect, final boolean definePosSize) {
+ int x = rect.getX();
+ int y = rect.getY();
+ int w = rect.getWidth();
+ int h = rect.getHeight();
+ final int s_w = screen.getWidth();
+ final int s_h = screen.getHeight();
+ boolean modPos = false;
+ boolean modSize = false;
+ if( 0 > x ) {
+ x = 0;
+ modPos = true;
+ }
+ if( 0 > y ) {
+ y = 0;
+ modPos = true;
+ }
+ if( s_w < x + w ) {
+ if( 0 < x ) {
+ x = 0;
+ modPos = true;
+ }
+ if( s_w < w ) {
+ w = s_w;
+ modSize = true;
+ }
+ }
+ if( s_h < y + h ) {
+ if( 0 < y ) {
+ y = 0;
+ modPos = true;
+ }
+ if( s_h < h ) {
+ h = s_h;
+ modSize = true;
+ }
+ }
+ if( modPos || modSize ) {
+ if( definePosSize ) {
+ if( modPos ) {
+ definePosition(x, y);
+ }
+ if( modSize ) {
+ defineSize(w, h);
+ }
+ }
+ return new Rectangle(x, y, w, h);
+ } else {
+ return rect;
+ }
+ }
+
+ @Override
+ protected boolean canCreateNativeImpl() {
+ // clamp if required incl. redefinition of position and size
+ clampRect((ScreenDriver) getScreen(), new Rectangle(getX(), getY(), getWidth(), getHeight()), true);
+ return true; // default: always able to be created
+ }
+
@Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
@@ -110,7 +180,8 @@ public class WindowDriver extends WindowImpl {
chosenCaps.setBackgroundOpaque(capsRequested.isBackgroundOpaque());
}
setGraphicsConfiguration(cfg);
- nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer, getX(), getY(), getWidth(), getHeight(),
+ nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer,
+ getX(), getY(), getWidth(), getHeight(),
chosenCaps.isBackgroundOpaque(), chosenCaps.getAlphaBits());
if (nativeWindowHandle == 0) {
throw new NativeWindowException("Error creating egl window: "+cfg);
@@ -155,7 +226,9 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final int flags) {
- reconfigure0(nativeWindowHandle, x, y, width, height, flags);
+ final RectangleImmutable rect = clampRect((ScreenDriver) getScreen(), new Rectangle(x, y, width, height), false);
+ // reconfigure0 will issue position/size changed events if required
+ reconfigure0(nativeWindowHandle, rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), flags);
return true;
}
@@ -174,7 +247,7 @@ public class WindowDriver extends WindowImpl {
final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) {
if( MouseEvent.EVENT_MOUSE_MOVED == eventType ) {
final DisplayDriver display = (DisplayDriver) getScreen().getDisplay();
- display.moveActivePointerIcon(x, y);
+ display.moveActivePointerIcon(getX() + x, getY() + y);
}
super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
}
diff --git a/src/newt/native/bcm_vc_iv.c b/src/newt/native/bcm_vc_iv.c
index 6b1ee3aaf..611dd5a4a 100644
--- a/src/newt/native/bcm_vc_iv.c
+++ b/src/newt/native/bcm_vc_iv.c
@@ -457,7 +457,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_bcm_vc_iv_WindowDriver_reconfigur
(*env)->CallVoidMethod(env, obj, positionChangedID, JNI_FALSE, x, y);
}
if( sizeChanged ) {
- (*env)->CallVoidMethod(env, obj, sizeChangedID, JNI_FALSE, (jint) width, (jint) height, JNI_FALSE);
+ (*env)->CallVoidMethod(env, obj, sizeChangedID, JNI_FALSE, width, height, JNI_FALSE);
}
}
diff --git a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java
index 50e0efd30..6269ce4e9 100644
--- a/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java
+++ b/src/oculusvr/classes/com/jogamp/oculusvr/OVRVersion.java
@@ -41,6 +41,16 @@ import java.util.jar.Manifest;
public class OVRVersion extends JogampVersion {
+ /**
+ * Default init-params for {@link OVR#ovr_Initialize(ovrInitParams)},
+ * w/ flags {@link OVR#ovrInit_ServerOptional}.
+ */
+ public static final ovrInitParams defaultInitParams;
+ static {
+ defaultInitParams = ovrInitParams.create();
+ defaultInitParams.setFlags(OVR.ovrInit_ServerOptional);
+ }
+
protected static volatile OVRVersion jogampCommonVersionInfo;
protected OVRVersion(final String packageName, final Manifest mf) {
@@ -64,7 +74,7 @@ public class OVRVersion extends JogampVersion {
if(null==sb) {
sb = new StringBuilder();
}
- if( !OVR.ovr_Initialize() ) { // recursive ..
+ if( !OVR.ovr_Initialize(defaultInitParams) ) { // recursive ..
sb.append("\tOVR not available").append(Platform.getNewline());
} else {
final ovrHmdDesc hmdDesc = OVR.ovrHmd_Create(ovrHmdIndex);
@@ -97,20 +107,23 @@ public class OVRVersion extends JogampVersion {
if(null==sb) {
sb = new StringBuilder();
}
- sb.append("\thmd."+ovrHmdIndex+".productName:\t"+hmdDesc.getProductNameAsString()).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".vendorName:\t"+hmdDesc.getManufacturerAsString()).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".deviceName:\t"+hmdDesc.getDisplayDeviceNameAsString()).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".productId:\t0x"+Integer.toHexString(hmdDesc.getProductId())).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".vendorId:\t0x"+Integer.toHexString(hmdDesc.getVendorId())).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".serial:\t"+hmdDesc.getSerialNumberAsString()).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".type:\t"+hmdDesc.getType()).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".hmdCaps:\t"+toHexString(hmdDesc.getHmdCaps())).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".distorCaps:\t"+toHexString(hmdDesc.getDistortionCaps())).append(Platform.getNewline());
- sb.append("\thmd."+ovrHmdIndex+".sensorCaps:\t"+toHexString(hmdDesc.getTrackingCaps())).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".productName: "+hmdDesc.getProductNameAsString()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".vendorName: "+hmdDesc.getManufacturerAsString()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".deviceName: "+hmdDesc.getDisplayDeviceNameAsString()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".productId: 0x"+Integer.toHexString(hmdDesc.getProductId())).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".vendorId: 0x"+Integer.toHexString(hmdDesc.getVendorId())).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".serial: "+hmdDesc.getSerialNumberAsString()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".firmware: "+hmdDesc.getFirmwareMajor()+"."+hmdDesc.getFirmwareMinor()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".type: "+hmdDesc.getType()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".hmdCaps: "+toHexString(hmdDesc.getHmdCaps())).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".distorCaps: "+toHexString(hmdDesc.getDistortionCaps())).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".sensorCaps: "+toHexString(hmdDesc.getTrackingCaps())).append(Platform.getNewline());
final ovrSizei resolution = hmdDesc.getResolution();
- sb.append("\thmd."+ovrHmdIndex+".resolution:\t"+resolution.getW()+"x"+resolution.getH()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".resolution: "+resolution.getW()+"x"+resolution.getH()).append(Platform.getNewline());
final ovrVector2i winPos = hmdDesc.getWindowsPos();
- sb.append("\thmd."+ovrHmdIndex+".winPos:\t"+winPos.getX()+" / "+winPos.getY()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".winPos: "+winPos.getX()+" / "+winPos.getY()).append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".cameraFrustum.Z: "+hmdDesc.getCameraFrustumNearZInMeters()+" - "+hmdDesc.getCameraFrustumFarZInMeters()+" meter").append(Platform.getNewline());
+ sb.append("\thmd."+ovrHmdIndex+".cameraFrustum.Fov: H "+hmdDesc.getCameraFrustumHFovInRadians()+" rad, V "+hmdDesc.getCameraFrustumVFovInRadians()+" rad").append(Platform.getNewline());
return sb;
}
private static String toHexString(final int v) { return "0x"+Integer.toHexString(v); }
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
index 3abea5839..5025e80c5 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDevice.java
@@ -38,7 +38,10 @@ import com.jogamp.oculusvr.ovrEyeRenderDesc;
import com.jogamp.oculusvr.ovrFovPort;
import com.jogamp.oculusvr.ovrHmdDesc;
import com.jogamp.oculusvr.ovrSizei;
+import com.jogamp.oculusvr.ovrTrackingState;
import com.jogamp.opengl.math.FovHVHalves;
+import com.jogamp.opengl.math.geom.Frustum;
+import com.jogamp.opengl.util.stereo.LocationSensorParameter;
import com.jogamp.opengl.util.stereo.StereoDevice;
import com.jogamp.opengl.util.stereo.StereoDeviceFactory;
import com.jogamp.opengl.util.stereo.StereoDeviceRenderer;
@@ -54,7 +57,11 @@ public class OVRStereoDevice implements StereoDevice {
public ovrHmdDesc hmdDesc;
public OvrHmdContext handle;
+
+ private final int supportedSensorBits;
+ private int usedSensorBits;
private boolean sensorsStarted = false;
+
private final int[] eyeRenderOrder;
private final int supportedDistortionBits, recommendedDistortionBits, minimumDistortionBits;
@@ -64,6 +71,8 @@ public class OVRStereoDevice implements StereoDevice {
private final PointImmutable position;
private final int dkVersion;
+ private final LocationSensorParameter locationSensorParams;
+
public OVRStereoDevice(final StereoDeviceFactory factory, final ovrHmdDesc hmdDesc, final int deviceIndex) {
if( null == hmdDesc ) {
throw new IllegalArgumentException("Passed null hmdDesc");
@@ -76,6 +85,7 @@ public class OVRStereoDevice implements StereoDevice {
this.handle = nativeContext;
this.deviceIndex = deviceIndex;
this.hmdDesc = hmdDesc;
+
final ovrFovPort[] defaultOVREyeFov = hmdDesc.getDefaultEyeFov(0, new ovrFovPort[ovrHmdDesc.getEyeRenderOrderArrayLength()]);
defaultEyeFov = new FovHVHalves[defaultOVREyeFov.length];
for(int i=0; i<defaultEyeFov.length; i++) {
@@ -84,9 +94,27 @@ public class OVRStereoDevice implements StereoDevice {
eyeRenderOrder = new int[ovrHmdDesc.getEyeRenderOrderArrayLength()];
hmdDesc.getEyeRenderOrder(0, eyeRenderOrder);
supportedDistortionBits = OVRUtil.ovrDistCaps2DistBits(hmdDesc.getDistortionCaps());
- recommendedDistortionBits = supportedDistortionBits & ~StereoDeviceRenderer.DISTORTION_TIMEWARP;
+ recommendedDistortionBits = supportedDistortionBits; // & ~StereoDeviceRenderer.DISTORTION_TIMEWARP;
minimumDistortionBits = StereoDeviceRenderer.DISTORTION_BARREL;
+ usedSensorBits = 0;
+ supportedSensorBits = OVRUtil.ovrTrackingCaps2SensorBits(hmdDesc.getTrackingCaps());
+
+ LocationSensorParameter _locationSensorParams = null;
+ if( StereoUtil.usesPositionSensor(supportedSensorBits)) {
+ try {
+ final FovHVHalves posFov = FovHVHalves.byRadians(hmdDesc.getCameraFrustumHFovInRadians(),
+ hmdDesc.getCameraFrustumVFovInRadians());
+ final float posZNear = hmdDesc.getCameraFrustumNearZInMeters();
+ final float posZFar = hmdDesc.getCameraFrustumFarZInMeters();
+ _locationSensorParams = new LocationSensorParameter(new Frustum.FovDesc(posFov, posZNear, posZFar));
+ } catch (final IllegalArgumentException iae) {
+ // probably zNear/zFar issue ..
+ System.err.println(iae.getMessage());
+ }
+ }
+ locationSensorParams = _locationSensorParams;
+
// DK1 delivers unrotated resolution in target orientation
// DK2 delivers rotated resolution in target orientation, monitor screen is rotated 90deg clockwise
deviceName = hmdDesc.getDisplayDeviceNameAsString();
@@ -122,13 +150,17 @@ public class OVRStereoDevice implements StereoDevice {
sb.append(", surfacePos "+getPosition());
sb.append(", distortionBits[supported ["+StereoUtil.distortionBitsToString(getSupportedDistortionBits())+
"], recommended ["+StereoUtil.distortionBitsToString(getRecommendedDistortionBits())+
- "], minimum ["+StereoUtil.distortionBitsToString(getMinimumDistortionBits())+"]]]");
+ "], minimum ["+StereoUtil.distortionBitsToString(getMinimumDistortionBits())+"]]");
+ sb.append(", sensorBits[supported ["+StereoUtil.sensorBitsToString(getSupportedSensorBits())+
+ "], enabled ["+StereoUtil.sensorBitsToString(getEnabledSensorBits())+"]]");
+ sb.append(", "+locationSensorParams+"]");
return sb.toString();
}
@Override
public final void dispose() {
if( isValid() ) {
+ stopSensors();
OVR.ovrHmd_Destroy(hmdDesc);
hmdDesc = null;
handle = null;
@@ -149,34 +181,84 @@ public class OVRStereoDevice implements StereoDevice {
public int getRequiredRotation() { return requiredRotation; }
@Override
- public float[] getDefaultEyePositionOffset() {
- return DEFAULT_EYE_POSITION_OFFSET;
- }
+ public float[] getDefaultEyePositionOffset() { return DEFAULT_EYE_POSITION_OFFSET; }
+
+ @Override
+ public final FovHVHalves[] getDefaultFOV() { return defaultEyeFov; }
+
+ @Override
+ public final LocationSensorParameter getLocationSensorParams() { return locationSensorParams; }
@Override
- public final FovHVHalves[] getDefaultFOV() {
- return defaultEyeFov;
+ public final void resetLocationSensorOrigin() {
+ if( isValid() && sensorsStarted && StereoUtil.usesPositionSensor(supportedSensorBits)) {
+ OVR.ovrHmd_RecenterPose(hmdDesc);
+ }
+ }
+
+ /* pp */ void updateUsedSensorBits(final ovrTrackingState trackingState) {
+ final int pre = usedSensorBits;
+ if( sensorsStarted && null != trackingState ) {
+ usedSensorBits = StereoDevice.SENSOR_ORIENTATION |
+ OVRUtil.ovrTrackingStats2SensorBits(trackingState.getStatusFlags());
+ } else {
+ usedSensorBits = 0;
+ }
+ if( StereoDevice.DEBUG ) {
+ if( pre != usedSensorBits ) {
+ System.err.println("XXX: Sensor Change: "+
+ ": pre["+StereoUtil.sensorBitsToString(pre)+"]"+
+ " -> now["+StereoUtil.sensorBitsToString(usedSensorBits)+"]");
+ }
+ }
}
@Override
- public final boolean startSensors(final boolean start) {
- if( start && !sensorsStarted ) {
+ public final boolean startSensors(final int desiredSensorBits, final int requiredSensorBits) {
+ if( isValid() && !sensorsStarted ) {
+ if( requiredSensorBits != ( supportedSensorBits & requiredSensorBits ) ) {
+ // required sensors not available
+ if( StereoDevice.DEBUG ) {
+ System.err.println("XXX: startSensors failed: n/a required sensors ["+StereoUtil.sensorBitsToString(requiredSensorBits)+"]");
+ }
+ return false;
+ }
+ if( 0 == ( supportedSensorBits & ( requiredSensorBits | desiredSensorBits ) ) ) {
+ // no sensors available
+ if( StereoDevice.DEBUG ) {
+ System.err.println("XXX: startSensors failed: n/a any sensors");
+ }
+ return false;
+ }
// Start the sensor which provides the Rift’s pose and motion.
- final int requiredTrackingCaps = 0;
- final int supportedTrackingCaps = requiredTrackingCaps |
- OVR.ovrTrackingCap_Orientation |
- OVR.ovrTrackingCap_MagYawCorrection |
- OVR.ovrTrackingCap_Position;
- if( OVR.ovrHmd_ConfigureTracking(hmdDesc, supportedTrackingCaps, requiredTrackingCaps) ) {
+ final int requiredTrackingCaps = OVRUtil.sensorBits2TrackingCaps(requiredSensorBits);
+ final int desiredTrackingCaps = requiredTrackingCaps | OVRUtil.sensorBits2TrackingCaps(desiredSensorBits);
+ final boolean res;
+ if( OVR.ovrHmd_ConfigureTracking(hmdDesc, desiredTrackingCaps, requiredTrackingCaps) ) {
sensorsStarted = true;
- return true;
+ updateUsedSensorBits(OVR.ovrHmd_GetTrackingState(hmdDesc, 0.0));
+ res = true;
} else {
- sensorsStarted = false;
- return false;
+ res = false;
+ }
+ if( StereoDevice.DEBUG ) {
+ System.err.println("XXX: startSensors: "+res+", started "+sensorsStarted+
+ ": required["+StereoUtil.sensorBitsToString(requiredSensorBits)+"]"+
+ ", desired["+StereoUtil.sensorBitsToString(desiredSensorBits)+"]"+
+ ", enabled["+StereoUtil.sensorBitsToString(usedSensorBits)+"]");
}
- } else if( sensorsStarted ) {
+ return res;
+ } else {
+ // No state change -> Success
+ return true;
+ }
+ }
+ @Override
+ public final boolean stopSensors() {
+ if( isValid() && sensorsStarted ) {
OVR.ovrHmd_ConfigureTracking(hmdDesc, 0, 0); // STOP
sensorsStarted = false;
+ usedSensorBits = 0;
return true;
} else {
// No state change -> Success
@@ -187,6 +269,16 @@ public class OVRStereoDevice implements StereoDevice {
public final boolean getSensorsStarted() { return sensorsStarted; }
@Override
+ public final int getSupportedSensorBits() {
+ return supportedSensorBits;
+ }
+
+ @Override
+ public final int getEnabledSensorBits() {
+ return usedSensorBits;
+ }
+
+ @Override
public final int[] getEyeRenderOrder() {
return eyeRenderOrder;
}
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
index 772891115..a0836b5a3 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
@@ -36,12 +36,13 @@ import com.jogamp.opengl.util.stereo.StereoDevice;
import com.jogamp.opengl.util.stereo.StereoDeviceFactory;
public class OVRStereoDeviceFactory extends StereoDeviceFactory {
-
public static boolean isAvailable() {
- if( OVR.ovr_Initialize() ) { // recursive ..
+ if( OVR.ovr_Initialize(OVRVersion.defaultInitParams) ) { // recursive ..
boolean res = false;
final int count = OVR.ovrHmd_Detect();
- System.err.println("Detect.0: ovrHmd_Detect() -> "+count);
+ if( StereoDevice.DEBUG ) {
+ System.err.println("Detect.0: ovrHmd_Detect() -> "+count);
+ }
if( 0 < count ) {
res = true;
} else {
@@ -54,6 +55,10 @@ public class OVRStereoDeviceFactory extends StereoDeviceFactory {
System.err.println("Detect.1: hmdDesc: "+hmdDesc.getProductNameAsString());
}
OVR.ovrHmd_Destroy(hmdDesc);
+ } else {
+ if( StereoDevice.DEBUG ) {
+ System.err.println("Detect.1: hmdDesc: null");
+ }
}
}
return res;
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
index 60fb8301e..95565dd0f 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceRenderer.java
@@ -54,6 +54,7 @@ import com.jogamp.oculusvr.ovrMatrix4f;
import com.jogamp.oculusvr.ovrPosef;
import com.jogamp.oculusvr.ovrRecti;
import com.jogamp.oculusvr.ovrSizei;
+import com.jogamp.oculusvr.ovrTrackingState;
import com.jogamp.oculusvr.ovrVector2f;
import com.jogamp.oculusvr.ovrVector3f;
import com.jogamp.opengl.JoglVersion;
@@ -62,7 +63,7 @@ import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.stereo.EyeParameter;
-import com.jogamp.opengl.util.stereo.EyePose;
+import com.jogamp.opengl.util.stereo.ViewerPose;
import com.jogamp.opengl.util.stereo.StereoDevice;
import com.jogamp.opengl.util.stereo.StereoDeviceRenderer;
import com.jogamp.opengl.util.stereo.StereoUtil;
@@ -93,12 +94,11 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
private final GLArrayData vboPos, vboParams, vboTexCoordsR, vboTexCoordsG, vboTexCoordsB;
private final GLArrayDataServer indices;
- private final ovrEyeRenderDesc ovrEyeDesc;
+ /* pp */ final ovrEyeRenderDesc ovrEyeDesc;
private final ovrFovPort ovrEyeFov;
private final EyeParameter eyeParameter;
- private ovrPosef ovrEyePose;
- private final EyePose eyePose;
+ private final ovrMatrix4f[] timeWarpMatrices;
@Override
public final RectangleImmutable getViewport() { return viewport; }
@@ -106,12 +106,9 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
@Override
public final EyeParameter getEyeParameter() { return eyeParameter; }
- @Override
- public final EyePose getLastEyePose() { return eyePose; }
-
- private OVREye(final ovrHmdDesc hmdDesc, final int distortionBits,
- final float[] eyePositionOffset, final ovrEyeRenderDesc eyeDesc,
- final ovrSizei ovrTextureSize, final RectangleImmutable eyeViewport) {
+ /* pp */ OVREye(final ovrHmdDesc hmdDesc, final int distortionBits,
+ final float[] eyePositionOffset, final ovrEyeRenderDesc eyeDesc,
+ final ovrSizei ovrTextureSize, final RectangleImmutable eyeViewport) {
this.eyeName = eyeDesc.getEye();
this.distortionBits = distortionBits;
this.viewport = eyeViewport;
@@ -125,9 +122,13 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
if( usesTimewarp ) {
eyeRotationStart = new GLUniformData("ovr_EyeRotationStart", 4, 4, Buffers.slice2Float(fstash, 4, 16));
eyeRotationEnd = new GLUniformData("ovr_EyeRotationEnd", 4, 4, Buffers.slice2Float(fstash, 20, 16));
+ timeWarpMatrices = new ovrMatrix4f[2];
+ timeWarpMatrices[0] = ovrMatrix4f.create();
+ timeWarpMatrices[1] = ovrMatrix4f.create();
} else {
eyeRotationStart = null;
eyeRotationEnd = null;
+ timeWarpMatrices = null;
}
this.ovrEyeDesc = eyeDesc;
@@ -137,14 +138,10 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
this.eyeParameter = new EyeParameter(eyeName, eyePositionOffset, OVRUtil.getFovHV(ovrEyeFov),
eyeViewAdjust.getX(), eyeViewAdjust.getY(), eyeViewAdjust.getZ());
- this.eyePose = new EyePose(eyeName);
-
- updateEyePose(hmdDesc); // 1st init
-
// Setup: eyeToSourceUVScale, eyeToSourceUVOffset
{
final ovrVector2f[] uvScaleOffsetOut = new ovrVector2f[2];
- uvScaleOffsetOut[0] = ovrVector2f.create(); // FIXME: remove ctor / double check
+ uvScaleOffsetOut[0] = ovrVector2f.create();
uvScaleOffsetOut[1] = ovrVector2f.create();
final ovrRecti ovrEyeRenderViewport = OVRUtil.createOVRRecti(eyeViewport);
@@ -194,7 +191,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
/** 2+2+2+2+2: { vec2 position, vec2 color, vec2 texCoordR, vec2 texCoordG, vec2 texCoordB } */
final FloatBuffer iVBOFB = (FloatBuffer)iVBO.getBuffer();
final ovrDistortionVertex[] ovRes = new ovrDistortionVertex[1];
- ovRes[0] = ovrDistortionVertex.create(); // FIXME: remove ctor / double check
+ ovRes[0] = ovrDistortionVertex.create();
for ( int vertNum = 0; vertNum < vertexCount; vertNum++ ) {
final ovrDistortionVertex ov = meshData.getPVertexData(vertNum, ovRes)[0];
@@ -275,7 +272,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
OVR.ovrHmd_DestroyDistortionMesh(meshData);
}
- private void linkData(final GL2ES2 gl, final ShaderProgram sp) {
+ /* pp */ void linkData(final GL2ES2 gl, final ShaderProgram sp) {
if( 0 > vboPos.setLocation(gl, sp.program()) ) {
throw new GLException("Couldn't locate "+vboPos);
}
@@ -313,16 +310,16 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
indices.enableBuffer(gl, false);
}
- private void dispose(final GL2ES2 gl) {
+ /* pp */ void dispose(final GL2ES2 gl) {
iVBO.destroy(gl);
indices.destroy(gl);
}
- private void enableVBO(final GL2ES2 gl, final boolean enable) {
+ /* pp */ void enableVBO(final GL2ES2 gl, final boolean enable) {
iVBO.enableBuffer(gl, enable);
indices.bindBuffer(gl, enable); // keeps VBO binding if enable:=true
}
- private void updateUniform(final GL2ES2 gl, final ShaderProgram sp) {
+ /* pp */ void updateUniform(final GL2ES2 gl, final ShaderProgram sp) {
gl.glUniform(eyeToSourceUVScale);
gl.glUniform(eyeToSourceUVOffset);
if( StereoUtil.usesTimewarpDistortion(distortionBits) ) {
@@ -331,10 +328,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
}
}
- private void updateTimewarp(final ovrHmdDesc hmdDesc, final ovrPosef eyeRenderPose, final float[] mat4Tmp1, final float[] mat4Tmp2) {
- final ovrMatrix4f[] timeWarpMatrices = new ovrMatrix4f[2];
- timeWarpMatrices[0] = ovrMatrix4f.create(); // FIXME: remove ctor / double check
- timeWarpMatrices[1] = ovrMatrix4f.create();
+ /* pp */ void updateTimewarp(final ovrHmdDesc hmdDesc, final ovrPosef eyeRenderPose, final float[] mat4Tmp1, final float[] mat4Tmp2) {
OVR.ovrHmd_GetEyeTimewarpMatrices(hmdDesc, eyeName, eyeRenderPose, timeWarpMatrices);
final float[] eyeRotationStartM = FloatUtil.transposeMatrix(timeWarpMatrices[0].getM(0, mat4Tmp1), mat4Tmp2);
@@ -348,19 +342,6 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
eyeRotationEndU.rewind();
}
- /**
- * Updates {@link #ovrEyePose} and it's extracted
- * {@link #eyeRenderPoseOrientation} and {@link #eyeRenderPosePosition}.
- * @param hmdCtx used get the {@link #ovrEyePose} via {@link OVR#ovrHmd_GetHmdPosePerEye(ovrHmdDesc, int)}
- */
- private EyePose updateEyePose(final ovrHmdDesc hmdDesc) {
- ovrEyePose = OVR.ovrHmd_GetHmdPosePerEye(hmdDesc, eyeName);
- final ovrVector3f pos = ovrEyePose.getPosition();
- eyePose.setPosition(pos.getX(), pos.getY(), pos.getZ());
- OVRUtil.copyToQuaternion(ovrEyePose.getOrientation(), eyePose.orientation);
- return eyePose;
- }
-
@Override
public String toString() {
return "Eye["+eyeName+", viewport "+viewport+
@@ -368,12 +349,16 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
", vertices "+vertexCount+", indices "+indexCount+
", uvScale["+eyeToSourceUVScale.floatBufferValue().get(0)+", "+eyeToSourceUVScale.floatBufferValue().get(1)+
"], uvOffset["+eyeToSourceUVOffset.floatBufferValue().get(0)+", "+eyeToSourceUVOffset.floatBufferValue().get(1)+
- "], desc"+OVRUtil.toString(ovrEyeDesc)+", "+eyePose+"]";
+ "], desc"+OVRUtil.toString(ovrEyeDesc)+"]";
}
}
private final OVRStereoDevice context;
private final OVREye[] eyes;
+ private final ovrPosef[] ovrEyePoses;
+ private final ovrVector3f[] hmdToEyeViewOffset;
+ private final ViewerPose viewerPose;
+ private final ovrTrackingState trackingState;
private final int distortionBits;
private final int textureCount;
private final DimensionImmutable[] eyeTextureSizes;
@@ -439,6 +424,16 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
}
eyes[0] = new OVREye(context.hmdDesc, this.distortionBits, eyePositionOffset, eyeRenderDescs[0], ovrTexture0Size, eyeViewports[0]);
eyes[1] = new OVREye(context.hmdDesc, this.distortionBits, eyePositionOffset, eyeRenderDescs[1], ovrTexture1Size, eyeViewports[1]);
+
+ ovrEyePoses = new ovrPosef[2];
+ ovrEyePoses[0] = ovrPosef.create();
+ ovrEyePoses[1] = ovrPosef.create();
+ hmdToEyeViewOffset = new ovrVector3f[2];
+ hmdToEyeViewOffset[0] = eyes[0].ovrEyeDesc.getHmdToEyeViewOffset();
+ hmdToEyeViewOffset[1] = eyes[1].ovrEyeDesc.getHmdToEyeViewOffset();
+ viewerPose = new ViewerPose();
+ trackingState = ovrTrackingState.create();
+
sp = null;
frameTiming = null;
frameCount = 0;
@@ -546,13 +541,33 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
}
@Override
- public final EyePose updateEyePose(final int eyeNum) {
- return eyes[eyeNum].updateEyePose(context.hmdDesc);
+ public final ViewerPose updateViewerPose() {
+ final ovrTrackingState trackingState;
+ trackingState = this.trackingState;
+ OVR.ovrHmd_GetEyePoses(context.hmdDesc, frameCount, hmdToEyeViewOffset, ovrEyePoses, trackingState);
+ context.updateUsedSensorBits(trackingState);
+
+ // Use headPose of tracking state, since it points to the viewer
+ // where ovrEyePoses already have hmdToEyeViewOffset applied (IPD .. etc).
+ final ovrPosef pose = trackingState.getHeadPose().getThePose();
+ final ovrVector3f pos = pose.getPosition();
+ viewerPose.setPosition(pos.getX(), pos.getY(), pos.getZ());
+ OVRUtil.copyToQuaternion(pose.getOrientation(), viewerPose.orientation);
+
+ // System.err.println("Viewer: "+OVRUtil.toString(pos));
+ // System.err.println("Camera: "+OVRUtil.toString(trackingState.getCameraPose().getPosition()));
+ // System.err.println("Leveld: "+OVRUtil.toString(trackingState.getLeveledCameraPose().getPosition()));
+ return viewerPose;
+ }
+
+ @Override
+ public final ViewerPose getLastViewerPose() {
+ return viewerPose;
}
@Override
public final void beginFrame(final GL gl) {
- frameTiming = OVR.ovrHmd_BeginFrameTiming(context.hmdDesc, 0); // ovrHmd_GetFrameTiming not used, otherwise: frameCount);
+ frameTiming = OVR.ovrHmd_BeginFrameTiming(context.hmdDesc, frameCount); // ovrHmd_GetFrameTiming not used, otherwise: frameCount);
}
@Override
@@ -574,7 +589,9 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
throw new IllegalStateException("beginFrame not called");
}
if( StereoUtil.usesTimewarpDistortion(distortionBits) ) {
+ // minimize latency
OVR.ovr_WaitTillTime(frameTiming.getTimewarpPointSeconds());
+ // {@link OVREye#updateTimewarp(ovrHmdDesc, ovrPosef, float[], float[])} will be called in {@link #ppOneEye}
}
final GL2ES2 gl2es2 = gl.getGL2ES2();
@@ -599,7 +616,7 @@ public class OVRStereoDeviceRenderer implements StereoDeviceRenderer {
public final void ppOneEye(final GL gl, final int eyeNum) {
final OVREye eye = eyes[eyeNum];
if( StereoUtil.usesTimewarpDistortion(distortionBits) ) {
- eye.updateTimewarp(context.hmdDesc, eye.ovrEyePose, mat4Tmp1, mat4Tmp2);
+ eye.updateTimewarp(context.hmdDesc, ovrEyePoses[eyeNum], mat4Tmp1, mat4Tmp2);
}
final GL2ES2 gl2es2 = gl.getGL2ES2();
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java
index c1d01fea2..e54bd61e8 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRUtil.java
@@ -44,6 +44,7 @@ import com.jogamp.oculusvr.ovrVector2i;
import com.jogamp.oculusvr.ovrVector3f;
import com.jogamp.opengl.math.FovHVHalves;
import com.jogamp.opengl.math.Quaternion;
+import com.jogamp.opengl.util.stereo.StereoDevice;
import com.jogamp.opengl.util.stereo.StereoDeviceRenderer;
/**
@@ -146,6 +147,42 @@ public class OVRUtil {
return bits;
}
+ public static int ovrTrackingCaps2SensorBits(final int ovrTrackingCaps) {
+ int bits = 0;
+ if( 0 != ( OVR.ovrTrackingCap_Orientation & ovrTrackingCaps ) ) {
+ bits |= StereoDevice.SENSOR_ORIENTATION;
+ }
+ if( 0 != ( OVR.ovrTrackingCap_MagYawCorrection & ovrTrackingCaps ) ) {
+ bits |= StereoDevice.SENSOR_YAW_CORRECTION;
+ }
+ if( 0 != ( OVR.ovrTrackingCap_Position & ovrTrackingCaps ) ) {
+ bits |= StereoDevice.SENSOR_POSITION;
+ }
+ return bits;
+ }
+ public static int ovrTrackingStats2SensorBits(final int ovrTrackingCaps) {
+ int bits = 0;
+ if( 0 != ( OVR.ovrStatus_OrientationTracked & ovrTrackingCaps ) ) {
+ bits |= StereoDevice.SENSOR_ORIENTATION;
+ }
+ if( 0 != ( OVR.ovrStatus_PositionTracked & ovrTrackingCaps ) ) {
+ bits |= StereoDevice.SENSOR_POSITION;
+ }
+ return bits;
+ }
+ public static int sensorBits2TrackingCaps(final int sensorBits) {
+ int caps = 0;
+ if( 0 != ( StereoDevice.SENSOR_ORIENTATION & sensorBits ) ) {
+ caps |= OVR.ovrTrackingCap_Orientation;
+ }
+ if( 0 != ( StereoDevice.SENSOR_YAW_CORRECTION & sensorBits ) ) {
+ caps |= OVR.ovrTrackingCap_MagYawCorrection;
+ }
+ if( 0 != ( StereoDevice.SENSOR_POSITION & sensorBits ) ) {
+ caps |= OVR.ovrTrackingCap_Position;
+ }
+ return caps;
+ }
public static String toString(final ovrFovPort fov) {
return "["+fov.getLeftTan()+" l, "+fov.getRightTan()+" r, "+
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
new file mode 100644
index 000000000..656cb47bd
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
@@ -0,0 +1,235 @@
+/**
+ * Copyright 2015 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore;
+
+import java.awt.AWTException;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Window;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Locale;
+
+import javax.swing.AbstractButton;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.awt.GLCanvas;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.DumpGLInfo;
+import com.jogamp.opengl.test.junit.util.GLClearColor;
+import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug1146GLContextDialogToolTipAWT extends UITestCase {
+ static final int NB_TEST = 5;
+ static final int ACTION_DELAY = 500;
+ static final int MOVE_DELAY = 2;
+ static final int MOVE_ITER = 100;
+ static final int TOOLTIP_WAIT = 3*1000; // 5s
+
+ static AbstractButton findButton(final int depth, final Container c, final String buttonText) {
+ AbstractButton res = null;
+ final int cc = c.getComponentCount();
+ for(int i=0; null==res && i<cc; i++) {
+ final Component e = c.getComponent(i);
+ // System.err.println("["+depth+"]["+i+"]: "+e.getClass().getSimpleName()+": "+e);
+ if( e instanceof AbstractButton ) {
+ final AbstractButton b = (AbstractButton) e;
+ final String bT = b.getText();
+ if( buttonText.equals(bT) ) {
+ res = b;
+ }
+ } else if( e instanceof Container ) {
+ res = findButton(depth+1, (Container)e, buttonText);
+ }
+ }
+ return res;
+ }
+
+ private void oneTest(final GLCapabilitiesImmutable caps) {
+ // base dialog
+ final JDialog dialog = new JDialog((Window) null);
+ dialog.setMinimumSize(new Dimension(500, 300));
+ dialog.setPreferredSize(new Dimension(500, 300));
+
+ dialog.setModal(false);
+
+ // build accessory
+ final GLEventListenerCounter glelc1 = new GLEventListenerCounter();
+ final GLCanvas canvas1 = new GLCanvas(caps);
+ canvas1.addGLEventListener(new DumpGLInfo(Platform.getNewline()+Platform.getNewline()+"Pre-ToolTip", false, false, false));
+ canvas1.addGLEventListener(new GLClearColor(1f, 0f, 0f, 1f));
+ canvas1.addGLEventListener(glelc1);
+ final JPanel panel1 = new JPanel(new BorderLayout());
+ panel1.add(canvas1, BorderLayout.CENTER);
+ panel1.setPreferredSize(new Dimension(300, 300));
+
+ final GLEventListenerCounter glelc2 = new GLEventListenerCounter();
+ final GLCanvas canvas2 = new GLCanvas(caps);
+ canvas2.addGLEventListener(new DumpGLInfo(Platform.getNewline()+Platform.getNewline()+"Post-ToolTip", false, false, false));
+ canvas2.addGLEventListener(new GLClearColor(0f, 0f, 1f, 1f));
+ canvas2.addGLEventListener(glelc2);
+ final JPanel panel2 = new JPanel(new BorderLayout());
+ panel2.add(canvas2, BorderLayout.CENTER);
+ panel2.setPreferredSize(new Dimension(300, 300));
+
+ // create file chooser with accessory
+ final JFileChooser fileChooser = new JFileChooser();
+ final String approveButtonText = "Approved";
+ fileChooser.setApproveButtonText(approveButtonText);
+ fileChooser.setApproveButtonToolTipText("Tool-Tip for Approved");
+ fileChooser.setAccessory(panel1);
+
+ final Locale l = fileChooser.getLocale();
+ final String cancelButtonText = UIManager.getString("FileChooser.cancelButtonText",l);
+
+ // launch robot action ..
+ new Thread()
+ {
+ public void run()
+ {
+ try {
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(fileChooser, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true));
+
+ final Point approveButtonPos;
+ final AbstractButton approveButton = findButton(0, fileChooser, approveButtonText);
+ if( null != approveButton ) {
+ approveButtonPos = approveButton.getLocationOnScreen();
+ approveButtonPos.translate(2, 2);
+ System.err.println("OK Button: "+approveButton.getClass().getSimpleName()+"; "+approveButton+", "+approveButtonPos);
+ } else {
+ System.err.println("OK Button: NULL");
+ approveButtonPos = null;
+ }
+ final Point cancelButtonPos;
+ final AbstractButton cancelButton = findButton(0, fileChooser, cancelButtonText);
+ if( null != approveButton ) {
+ cancelButtonPos = cancelButton.getLocationOnScreen();
+ cancelButtonPos.translate(2, 2);
+ System.err.println("CANCEL Button: "+cancelButton.getClass().getSimpleName()+"; "+cancelButton+", "+cancelButtonPos);
+ } else {
+ cancelButtonPos = null;
+ System.err.println("CANCEL Button: NULL");
+ }
+ final Robot robot = new Robot();
+ // hover to 'approve' -> tool tip
+ if( null != approveButtonPos ) {
+ AWTRobotUtil.mouseMove(robot, approveButtonPos, MOVE_ITER, MOVE_DELAY);
+ Thread.sleep(TOOLTIP_WAIT);
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ fileChooser.setAccessory(panel2);
+ fileChooser.validate();
+ } } ) ;
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ } catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true));
+ }
+ if( null != cancelButtonPos ) {
+ AWTRobotUtil.mouseClick(robot, cancelButtonPos, MOVE_ITER, MOVE_DELAY, ACTION_DELAY);
+ } else {
+ // oops ..
+ fileChooser.cancelSelection();
+ }
+ } catch (final AWTException e1) {
+ e1.printStackTrace();
+ } catch (final InterruptedException e2) {
+ e2.printStackTrace();
+ }
+ }
+ }.start();
+
+ // show file chooser dialog
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ dialog.setVisible(true);
+ fileChooser.showOpenDialog(dialog);
+ } } ) ;
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ } catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+
+ // dispose of resources
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ canvas1.destroy();
+ canvas2.destroy();
+ dialog.setVisible(false);
+ dialog.dispose();
+ } } ) ;
+ } catch (final InterruptedException e) {
+ e.printStackTrace();
+ } catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+
+ Assert.assertEquals(1, glelc1.initCount);
+ Assert.assertEquals(1, glelc2.initCount);
+ }
+
+ @Test
+ public void test01() {
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ for (int i = 0; i < NB_TEST; i++) {
+ System.out.println("Iteration " + i + " / " + NB_TEST);
+ oneTest(caps);
+ }
+ }
+
+ public static void main(final String[] pArgs)
+ {
+ org.junit.runner.JUnitCore.main(TestBug1146GLContextDialogToolTipAWT.class.getName());
+ }
+} \ No newline at end of file
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
index 395f6661d..7b8fa077a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
@@ -56,12 +56,12 @@ public class TestVersionSemanticsNOUI extends SingletonJunitCase {
static final VersionNumberString curVersionNumber = new VersionNumberString(curVersion.getImplementationVersion());
static final Set<String> excludesDefault;
- static final Set<String> excludesV230V23X;
+ static final Set<String> excludesStereoPackage;
static {
excludesDefault = new HashSet<String>();
excludesDefault.add("^\\Qjogamp/\\E.*$");
- excludesV230V23X = new HashSet<String>(excludesDefault);
- excludesV230V23X.add("^\\Qcom/jogamp/opengl/util/stereo/\\E.*$");
+ excludesStereoPackage = new HashSet<String>(excludesDefault);
+ excludesStereoPackage.add("^\\Qcom/jogamp/opengl/util/stereo/\\E.*$");
}
@@ -138,7 +138,7 @@ public class TestVersionSemanticsNOUI extends SingletonJunitCase {
VersionSemanticsUtil.testVersion(diffCriteria, expectedCompatibilityType,
previousJar, preVersionNumber,
curVersion.getClass(), currentCL, curVersionNumber,
- excludesV230V23X);
+ excludesStereoPackage);
}
public static void main(final String args[]) throws IOException {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index e95c2a9da..f70df89dc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -43,7 +43,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.stereo.EyeParameter;
-import com.jogamp.opengl.util.stereo.EyePose;
+import com.jogamp.opengl.util.stereo.ViewerPose;
import com.jogamp.opengl.util.stereo.StereoGLEventListener;
import java.nio.FloatBuffer;
@@ -407,9 +407,11 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen
private final float[] vec3Tmp2 = new float[3];
private final float[] vec3Tmp3 = new float[3];
+ private static final float[] vec3ScalePos = new float[] { 20f, 20f, 20f };
+
@Override
public void reshapeForEye(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height,
- final EyeParameter eyeParam, final EyePose eyePose) {
+ final EyeParameter eyeParam, final ViewerPose viewerPose) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
final float[] mat4Projection = FloatUtil.makePerspective(mat4Tmp1, 0, true, eyeParam.fovhv, zNear, zFar);
@@ -426,10 +428,12 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen
final Quaternion rollPitchYaw = new Quaternion();
// private final float eyeYaw = FloatUtil.PI; // 180 degrees in radians
// rollPitchYaw.rotateByAngleY(eyeYaw);
- final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, eyePose.position, 0);
+ // final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, viewerPose.position, 0);
+ final float[] shiftedEyePos = VectorUtil.copyVec3(vec3Tmp1, 0, viewerPose.position, 0);
+ VectorUtil.scaleVec3(shiftedEyePos, shiftedEyePos, vec3ScalePos); // amplify viewerPose position
VectorUtil.addVec3(shiftedEyePos, shiftedEyePos, eyeParam.positionOffset);
- rollPitchYaw.mult(eyePose.orientation);
+ rollPitchYaw.mult(viewerPose.orientation);
final float[] up = rollPitchYaw.rotateVector(vec3Tmp2, 0, VectorUtil.VEC3_UNIT_Y, 0);
final float[] forward = rollPitchYaw.rotateVector(vec3Tmp3, 0, VectorUtil.VEC3_UNIT_Z_NEG, 0);
final float[] center = VectorUtil.addVec3(forward, shiftedEyePos, forward);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
index 57aa76c82..e936bf991 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
@@ -46,6 +46,7 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.font.Font;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -71,7 +72,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.stereo.EyeParameter;
-import com.jogamp.opengl.util.stereo.EyePose;
+import com.jogamp.opengl.util.stereo.ViewerPose;
import com.jogamp.opengl.util.stereo.StereoClientRenderer;
import com.jogamp.opengl.util.stereo.StereoGLEventListener;
import com.jogamp.opengl.util.texture.Texture;
@@ -415,7 +416,7 @@ public class MovieSBSStereo implements StereoGLEventListener {
", "+drawable.getClass().getName()+", "+drawable);
if(waitForKey) {
- UITestCase.waitForKey("Init>");
+ JunitTracer.waitForKey("Init>");
}
final Texture tex;
try {
@@ -639,9 +640,11 @@ public class MovieSBSStereo implements StereoGLEventListener {
GLArrayDataServer interleavedVBOCurrent = null;
+ private static final float[] vec3ScalePos = new float[] { 4f, 4f, 4f };
+
@Override
public void reshapeForEye(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height,
- final EyeParameter eyeParam, final EyePose eyePose) {
+ final EyeParameter eyeParam, final ViewerPose viewerPose) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
interleavedVBOCurrent = 0 == eyeParam.number ? interleavedVBOLeft : interleavedVBORight;
@@ -657,10 +660,11 @@ public class MovieSBSStereo implements StereoGLEventListener {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
final Quaternion rollPitchYaw = new Quaternion();
- final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, eyePose.position, 0);
+ final float[] shiftedEyePos = rollPitchYaw.rotateVector(vec3Tmp1, 0, viewerPose.position, 0);
+ VectorUtil.scaleVec3(shiftedEyePos, shiftedEyePos, vec3ScalePos); // amplify viewerPose position
VectorUtil.addVec3(shiftedEyePos, shiftedEyePos, eyeParam.positionOffset);
- rollPitchYaw.mult(eyePose.orientation);
+ rollPitchYaw.mult(viewerPose.orientation);
final float[] up = rollPitchYaw.rotateVector(vec3Tmp2, 0, VectorUtil.VEC3_UNIT_Y, 0);
final float[] forward = rollPitchYaw.rotateVector(vec3Tmp3, 0, VectorUtil.VEC3_UNIT_Z_NEG, 0);
final float[] center = VectorUtil.addVec3(forward, shiftedEyePos, forward);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp
index 3210762b1..82268958f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp
@@ -6,9 +6,15 @@
#define mgl_FragColor gl_FragColor
#endif
+#ifdef GL_ES
+ #define MEDIUMP mediump
+#else
+ #define MEDIUMP
+#endif
+
// [0].rgba: 0, smooth, attnMinSz, attnMaxSz
// [1].rgba: attnCoeff(3), attnFadeTs
-uniform vec4 mgl_PointParams[2];
+uniform MEDIUMP vec4 mgl_PointParams[2];
#define pointSmooth (mgl_PointParams[0].g)
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp
index 4fa49b901..562874785 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp
@@ -4,12 +4,18 @@
#define varying out
#endif
+#ifdef GL_ES
+ #define MEDIUMP mediump
+#else
+ #define MEDIUMP
+#endif
+
uniform vec4 mgl_ColorStatic;
uniform mat4 mgl_PMVMatrix[4]; // P, Mv, Mvi and Mvit (transpose(inverse(ModelView)) == normalMatrix)
// [0].rgba: 0, smooth, attnMinSz, attnMaxSz
// [1].rgba: attnCoeff(3), attnFadeTs
-uniform vec4 mgl_PointParams[2];
+uniform MEDIUMP vec4 mgl_PointParams[2];
#define pointSmooth (mgl_PointParams[0].g)
#define pointSizeMin (mgl_PointParams[0].b)
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 693f2f72b..0d1f1700d 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
@@ -34,8 +34,10 @@ import java.util.Arrays;
import com.jogamp.nativewindow.util.DimensionImmutable;
import com.jogamp.nativewindow.util.PointImmutable;
import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLRunnable;
import jogamp.opengl.util.stereo.GenericStereoDevice;
@@ -244,11 +246,6 @@ public class StereoDemo01 {
}
System.err.println("StereoDevice "+stereoDevice);
- // Start the sensor which provides the Rift’s pose and motion.
- if( !stereoDevice.startSensors(true) ) {
- System.err.println("Could not start sensors on device "+deviceIndex);
- }
-
//
//
//
@@ -260,6 +257,11 @@ public class StereoDemo01 {
final MonitorDevice monitor = StereoDeviceUtil.getMonitorDevice(stereoDevice, true);
final Screen screen = monitor.getScreen();
+ // Start the sensor which provides the Rift’s pose and motion.
+ if( !stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0) ) {
+ System.err.println("Could not start sensors on device "+deviceIndex);
+ }
+
final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxProgrammable(true /* favorHardwareRasterizer */));
final GLWindow window = GLWindow.create(screen, caps);
@@ -334,8 +336,30 @@ public class StereoDemo01 {
return;
}
switch(e.getKeySymbol()) {
+ case KeyEvent.VK_O: {
+ window.invoke(false, new GLRunnable() {
+ @Override
+ public boolean run(final GLAutoDrawable drawable) {
+ stereoDevice.resetLocationSensorOrigin();
+ return true;
+ } });
+ break;
+ }
+ case KeyEvent.VK_P: {
+ window.invoke(false, new GLRunnable() {
+ @Override
+ public boolean run(final GLAutoDrawable drawable) {
+ System.err.println(stereoDeviceRenderer.getLastViewerPose());
+ return true;
+ } });
+ break;
+ }
case KeyEvent.VK_R: {
- stereoDevice.startSensors(!stereoDevice.getSensorsStarted());
+ if( stereoDevice.getSensorsStarted() ) {
+ stereoDevice.stopSensors();
+ } else {
+ stereoDevice.startSensors(stereoDevice.getSupportedSensorBits(), 0);
+ }
break;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index d9e9fc0cb..bdb03ba1d 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -36,7 +36,10 @@ import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.atomic.AtomicInteger;
import java.awt.AWTException;
import java.awt.EventQueue;
+import java.awt.MouseInfo;
+import java.awt.Point;
import java.awt.Robot;
+import java.awt.event.InputEvent;
import com.jogamp.nativewindow.NativeWindow;
import com.jogamp.nativewindow.NativeWindowFactory;
@@ -579,6 +582,25 @@ public class AWTRobotUtil {
Assert.assertEquals("Wrong key count", typeCount, counter.getCount()-c0);
}
+ public static void mouseMove(final Robot robot, final Point destination, final int iter, final int delay) {
+ final Point origin = MouseInfo.getPointerInfo().getLocation();
+ for (int i = 1; i <= iter; i++) {
+ final float alpha = i / (float) iter;
+ robot.mouseMove((int) (origin.x * (1 - alpha) + destination.x * alpha),
+ (int) (origin.y * (1 - alpha) + destination.y * alpha));
+ robot.delay(delay);
+ }
+ }
+ public static void mouseClick(final Robot robot, final Point pos, final int moveIter, final int moveDelay, final int actionDelay) {
+ robot.delay(actionDelay);
+ mouseMove(robot, pos, moveIter, moveDelay);
+
+ robot.delay(actionDelay);
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+ robot.delay(actionDelay);
+ }
+
static int mouseClick(final int i, final Robot robot, final int mouseButton,
final Object obj, final InputEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
{
diff --git a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
index a2887112f..76f73989a 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java
@@ -34,10 +34,32 @@ import com.jogamp.opengl.JoglVersion;
public class DumpGLInfo implements GLEventListener {
+ final String header;
+ final boolean withGLAvailability;
+ final boolean withCapabilities;
+ final boolean withExtensions;
+
+ public DumpGLInfo(final String header, final boolean withGLAvailability, final boolean withCapabilities, final boolean withExtensions) {
+ this.header = header;
+ this.withGLAvailability = withGLAvailability;
+ this.withCapabilities = withCapabilities;
+ this.withExtensions = withExtensions;
+ }
+ public DumpGLInfo() {
+ this.header = null;
+ this.withGLAvailability = true;
+ this.withCapabilities = true;
+ this.withExtensions = true;
+ }
public void init(final GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
- System.err.println(JoglVersion.getGLInfo(gl, null, true));
+ if( null != header ) {
+ System.err.println(header);
+ }
+ System.err.println(JoglVersion.getGLInfo(gl, null, withGLAvailability, withCapabilities, withExtensions));
+ System.err.println("Drawable: "+drawable.getDelegatedDrawable().getClass().getSimpleName());
+ System.err.println(drawable.getChosenGLCapabilities());
}
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {