diff options
author | Joshua Slack <[email protected]> | 2013-06-19 15:13:00 -0700 |
---|---|---|
committer | Joshua Slack <[email protected]> | 2013-06-19 15:13:00 -0700 |
commit | 21a3ca9fc5294a991e8acab8be0f45b6045357fa (patch) | |
tree | 8f5ce57e3b638e965e57ec1bfde4a004459d0703 | |
parent | d467c8e90a46018c08df3b5606e2e7cf7c533896 (diff) | |
parent | 1dbe6a9d1aec9240be294e0dca74df79377cfc05 (diff) |
Merge pull request #51 from gouessej/master
Fixes the offscreen rendering using FBOs and adds the support of more mouse buttons
3 files changed, 29 insertions, 7 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java index a99556e..6d2e378 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java +++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java @@ -15,7 +15,7 @@ import java.util.EnumMap; import com.google.common.collect.Maps; public enum MouseButton { - LEFT, RIGHT, MIDDLE; + LEFT, RIGHT, MIDDLE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE; public static EnumMap<MouseButton, ButtonState> makeMap(final ButtonState left, final ButtonState right, final ButtonState middle) { diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java index 182e769..4fe54c5 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseWrapper.java @@ -30,9 +30,9 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multiset; import com.google.common.collect.PeekingIterator; -import com.jogamp.newt.event.InputEvent; import com.jogamp.newt.event.MouseEvent; import com.jogamp.newt.event.MouseListener; +import com.jogamp.newt.event.NEWTEvent; import com.jogamp.newt.opengl.GLWindow; public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { @@ -104,7 +104,7 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { initState(me); if (_consumeEvents) { - me.setAttachment(InputEvent.consumedTag); + me.setAttachment(NEWTEvent.consumedTag); } final EnumMap<MouseButton, ButtonState> buttons = _lastState.getButtonStates(); @@ -118,7 +118,7 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { public synchronized void mouseReleased(final MouseEvent me) { initState(me); if (_consumeEvents) { - me.setAttachment(InputEvent.consumedTag); + me.setAttachment(NEWTEvent.consumedTag); } final EnumMap<MouseButton, ButtonState> buttons = _lastState.getButtonStates(); @@ -151,7 +151,7 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { // check that we have a valid _lastState initState(me); if (_consumeEvents) { - me.setAttachment(InputEvent.consumedTag); + me.setAttachment(NEWTEvent.consumedTag); } // remember our current ardor3d position @@ -206,7 +206,7 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { addNewState(me, _lastState.getButtonStates(), null); if (_consumeEvents) { - me.setAttachment(InputEvent.consumedTag); + me.setAttachment(NEWTEvent.consumedTag); } } @@ -263,6 +263,24 @@ public class JoglNewtMouseWrapper implements MouseWrapper, MouseListener { case MouseEvent.BUTTON3: button = MouseButton.RIGHT; break; + case MouseEvent.BUTTON4: + button = MouseButton.FOUR; + break; + case MouseEvent.BUTTON5: + button = MouseButton.FIVE; + break; + case MouseEvent.BUTTON6: + button = MouseButton.SIX; + break; + case MouseEvent.BUTTON7: + button = MouseButton.SEVEN; + break; + case MouseEvent.BUTTON8: + button = MouseButton.EIGHT; + break; + case MouseEvent.BUTTON9: + button = MouseButton.NINE; + break; default: throw new RuntimeException("unknown button: " + me.getButton()); } diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java index f17c18b..7e8adc0 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java @@ -21,6 +21,7 @@ import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; +import javax.media.opengl.GLDrawable; import javax.media.opengl.GLException; import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; @@ -674,8 +675,11 @@ public class JoglTextureStateUtil { continue; } } else { + final GLDrawable drawable = GLContext.getCurrent().getGLDrawable(); + // forces the rebinding when the drawable uses a frame buffer object + final boolean fbo = drawable.getChosenGLCapabilities().isFBO(); // texture already exists in OpenGL, just bind it if needed - if (!unitRecord.isValid() || unitRecord.boundTexture != textureId) { + if (!unitRecord.isValid() || unitRecord.boundTexture != textureId || fbo) { checkAndSetUnit(i, record, caps); gl.glBindTexture(getGLType(type), textureId); if (Constants.stats) { |