aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl/src/main
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2015-02-10 21:45:38 +0100
committerJulien Gouesse <[email protected]>2015-02-10 21:45:38 +0100
commita21486db32a7075faa7825bded82a65d2fc221bf (patch)
tree87284fad16ba8a200be0ededee1d02a2fb61bee8 /ardor3d-jogl/src/main
parentc2c1e4506c7f0c550d1027c0baf510daa60ac9dd (diff)
Moves the JOGL SWT canvases into a separate sub-project called ardor3d-jogl-swt
Diffstat (limited to 'ardor3d-jogl/src/main')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtSwtCanvas.java113
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtCanvas.java105
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtInitializerRunnable.java42
3 files changed, 0 insertions, 260 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtSwtCanvas.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtSwtCanvas.java
deleted file mode 100644
index 22f52fa..0000000
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtSwtCanvas.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Copyright (c) 2008-2010 Ardor Labs, Inc.
- *
- * This file is part of Ardor3D.
- *
- * Ardor3D is free software: you can redistribute it and/or modify it
- * under the terms of its license which may be found in the accompanying
- * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
- */
-
-package com.ardor3d.framework.jogl;
-
-import java.util.concurrent.CountDownLatch;
-
-import com.jogamp.opengl.GLAutoDrawable;
-import com.jogamp.opengl.GLRunnable;
-
-import org.eclipse.swt.widgets.Composite;
-
-import com.ardor3d.annotation.MainThread;
-import com.ardor3d.framework.Canvas;
-import com.ardor3d.framework.DisplaySettings;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.newt.swt.NewtCanvasSWT;
-
-/**
- * Ardor3D JOGL SWT lightweight canvas, SWT control for the OpenGL rendering of Ardor3D with JOGL that supports both
- * NEWT and SWT input systems directly and their abstractions in Ardor3D (com.ardor3d.input.jogl and
- * com.ardor3d.input.swt)
- */
-public class JoglNewtSwtCanvas extends NewtCanvasSWT implements Canvas, NewtWindowContainer {
-
- private final JoglCanvasRenderer _canvasRenderer;
- private boolean _inited = false;
-
- private final DisplaySettings _settings;
-
- private final JoglDrawerRunnable _drawerGLRunnable;
-
- public JoglNewtSwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer,
- final Composite composite, final int style) {
- this(settings, canvasRenderer, new CapsUtil(), composite, style);
- }
-
- public JoglNewtSwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer,
- final CapsUtil capsUtil, final Composite composite, final int style) {
- super(composite, style, GLWindow.create(capsUtil.getCapsForSettings(settings)));
- _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer);
- getNewtWindow().setUndecorated(true);
- _settings = settings;
- _canvasRenderer = canvasRenderer;
-
- setSize(_settings.getWidth(), _settings.getHeight());
- getNewtWindow().setAutoSwapBufferMode(false);
- }
-
- @Override
- @MainThread
- public void init() {
- if (_inited) {
- return;
- }
-
- // Make the window visible to realize the OpenGL surface.
- setVisible(true);
- if (getNewtWindow().isRealized()) {
- _canvasRenderer.setContext(getNewtWindow().getContext());
- getNewtWindow().invoke(true, new GLRunnable() {
- @Override
- public boolean run(final GLAutoDrawable glAutoDrawable) {
- _canvasRenderer.init(_settings, true);// true - do swap in renderer.
- return true;
- }
- });
- _inited = true;
- }
- }
-
- @Override
- public void draw(final CountDownLatch latch) {
- if (!_inited) {
- init();
- }
-
- if (isVisible()) {
- getNewtWindow().invoke(true, _drawerGLRunnable);
- }
- if (latch != null) {
- latch.countDown();
- }
- }
-
- @Override
- public JoglCanvasRenderer getCanvasRenderer() {
- return _canvasRenderer;
- }
-
- @Override
- public GLWindow getNewtWindow() {
- return (GLWindow) getNEWTChild();
- }
-
- public void setVSyncEnabled(final boolean enabled) {
- getNewtWindow().invoke(true, new GLRunnable() {
- @Override
- public boolean run(final GLAutoDrawable glAutoDrawable) {
- glAutoDrawable.getGL().setSwapInterval(enabled ? 1 : 0);
- return false;
- }
- });
- }
-
-}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtCanvas.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtCanvas.java
deleted file mode 100644
index fbdf1bb..0000000
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtCanvas.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Copyright (c) 2008-2014 Ardor Labs, Inc.
- *
- * This file is part of Ardor3D.
- *
- * Ardor3D is free software: you can redistribute it and/or modify it
- * under the terms of its license which may be found in the accompanying
- * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
- */
-
-package com.ardor3d.framework.jogl;
-
-import java.util.concurrent.CountDownLatch;
-
-import com.jogamp.opengl.GLAutoDrawable;
-import com.jogamp.opengl.GLRunnable;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-import com.ardor3d.annotation.MainThread;
-import com.ardor3d.framework.Canvas;
-import com.ardor3d.framework.DisplaySettings;
-import com.jogamp.opengl.swt.GLCanvas;
-
-/**
- * Ardor3D JOGL SWT heavyweight canvas, SWT control for the OpenGL rendering of Ardor3D with JOGL that supports the SWT
- * input system directly and its abstraction in Ardor3D (com.ardor3d.input.swt)
- */
-public class JoglSwtCanvas extends GLCanvas implements Canvas {
-
- private final JoglCanvasRenderer _canvasRenderer;
- private boolean _inited = false;
-
- private final DisplaySettings _settings;
-
- private final JoglDrawerRunnable _drawerGLRunnable;
-
- private final JoglSwtInitializerRunnable _initializerRunnable;
-
- public JoglSwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer,
- final Composite composite, final int style) {
- this(settings, canvasRenderer, new CapsUtil(), composite, style);
- }
-
- public JoglSwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer,
- final CapsUtil capsUtil, final Composite composite, final int style) {
- super(composite, style, capsUtil.getCapsForSettings(settings), null);
- _drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer);
- _initializerRunnable = new JoglSwtInitializerRunnable(this, settings);
- _settings = settings;
- _canvasRenderer = canvasRenderer;
-
- setFocus();
- setSize(_settings.getWidth(), _settings.getHeight());
- setAutoSwapBufferMode(false);
- }
-
- @Override
- @MainThread
- public void init() {
- if (_inited) {
- return;
- }
-
- // if we aren't on SWT user interface thread
- if (Display.getCurrent() == null) {
- Display.getDefault().syncExec(_initializerRunnable);
- } else {
- _initializerRunnable.run();
- }
-
- _inited = isRealized();
- }
-
- @Override
- public void draw(final CountDownLatch latch) {
- if (!_inited) {
- init();
- }
-
- if (isVisible()) {
- invoke(true, _drawerGLRunnable);
- }
- if (latch != null) {
- latch.countDown();
- }
- }
-
- @Override
- public JoglCanvasRenderer getCanvasRenderer() {
- return _canvasRenderer;
- }
-
- public void setVSyncEnabled(final boolean enabled) {
- invoke(true, new GLRunnable() {
- @Override
- public boolean run(final GLAutoDrawable glAutoDrawable) {
- glAutoDrawable.getGL().setSwapInterval(enabled ? 1 : 0);
- return false;
- }
- });
- }
-
-}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtInitializerRunnable.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtInitializerRunnable.java
deleted file mode 100644
index f580221..0000000
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglSwtInitializerRunnable.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2008-2010 Ardor Labs, Inc.
- *
- * This file is part of Ardor3D.
- *
- * Ardor3D is free software: you can redistribute it and/or modify it
- * under the terms of its license which may be found in the accompanying
- * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
- */
-
-package com.ardor3d.framework.jogl;
-
-import com.ardor3d.framework.DisplaySettings;
-
-public class JoglSwtInitializerRunnable implements Runnable {
-
- private final JoglSwtCanvas _joglSwtCanvas;
-
- private final DisplaySettings _settings;
-
- public JoglSwtInitializerRunnable(final JoglSwtCanvas joglSwtCanvas, final DisplaySettings settings) {
- _joglSwtCanvas = joglSwtCanvas;
- _settings = settings;
- }
-
- @Override
- public void run() {
- // Make the window visible to realize the OpenGL surface.
- _joglSwtCanvas.setVisible(true);
- // Force the realization
- _joglSwtCanvas.display();
- if (_joglSwtCanvas.getDelegatedDrawable().isRealized()) {
- // Request the focus here as it cannot work when the window is not visible
- _joglSwtCanvas.setFocus();
- // The OpenGL context has been created after the realization of the surface
- _joglSwtCanvas.getCanvasRenderer().setContext(_joglSwtCanvas.getContext());
- // As the canvas renderer knows the OpenGL context, it can be initialized
- _joglSwtCanvas.getCanvasRenderer().init(_settings, true);
- }
- }
-
-}