summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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/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.java12
-rw-r--r--src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java3
-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
8 files changed, 106 insertions, 11 deletions
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/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..1b85e8450 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);
diff --git a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
index 772891115..f9969a9ad 100644
--- a/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
+++ b/src/oculusvr/classes/jogamp/opengl/oculusvr/OVRStereoDeviceFactory.java
@@ -36,9 +36,8 @@ 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);
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)