summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-12-14 16:17:34 +0000
committerkcr <kcr@28c7f869-5b4e-e670-f602-82bfaf57f300>2006-12-14 16:17:34 +0000
commit7c124dbe0a6a17c78fb163e6ed53496503b3fa03 (patch)
tree873216a9a0ef0b10b9855ab4abd73bd04f3c01a1 /src
parent5d49942bc9effdc9534b6523cf92f257476e0c9a (diff)
Show error dialog if NPOT textures are not supported
Diffstat (limited to 'src')
-rw-r--r--src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java b/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java
index 3976f0b..0c66fbb 100644
--- a/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java
+++ b/src/classes/org/jdesktop/j3d/examples/texture/TextureImageNPOT.java
@@ -44,15 +44,17 @@
package org.jdesktop.j3d.examples.texture;
-import java.applet.Applet;
-import java.awt.*;
import com.sun.j3d.utils.applet.MainFrame;
-import com.sun.j3d.utils.universe.*;
-import com.sun.j3d.utils.image.TextureLoader;
import com.sun.j3d.utils.geometry.Box;
-import javax.media.j3d.*;
-import javax.vecmath.*;
+import com.sun.j3d.utils.image.TextureLoader;
+import com.sun.j3d.utils.universe.SimpleUniverse;
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.GraphicsConfiguration;
import java.util.Map;
+import javax.media.j3d.*;
+import javax.swing.JOptionPane;
+import javax.vecmath.Point3d;
import org.jdesktop.j3d.examples.Resources;
public class TextureImageNPOT extends Applet {
@@ -170,13 +172,24 @@ public class TextureImageNPOT extends Applet {
Canvas3D c = new Canvas3D(config);
- Map map = c.queryProperties();
+ Map map = c.queryProperties();
Boolean value = (Boolean) map.get("textureNonPowerOfTwoAvailable");
- if (value != null) {
- System.out.println("textureNonPowerOfTwoAvailable property = " + value);
- } else {
- System.out.println("textureNonPowerOfTwoAvailable property not found");
- }
+ String errorStr = null;
+ if (value == null) {
+ errorStr = "Canvas3D: textureNonPowerOfTwoAvailable property not found";
+ } else if (!value) {
+ errorStr = "Non-power-of-two textures are not available";
+ }
+
+ if (errorStr != null) {
+ String errorMessage = errorStr + "\n" +
+ "You should expect to see a white cube as a result";
+ System.err.println(errorMessage);
+ JOptionPane.showMessageDialog(this,
+ errorMessage,
+ "Insufficient Capabilities",
+ JOptionPane.ERROR_MESSAGE);
+ }
add("Center", c);