aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/jogl/javax/media/j3d/JoglPipeline.java21
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java12
-rw-r--r--src/classes/share/javax/media/j3d/ImageComponentRetained.java30
-rw-r--r--src/classes/share/javax/media/j3d/NativePipeline.java14
-rw-r--r--src/classes/share/javax/media/j3d/NoopPipeline.java5
-rw-r--r--src/classes/share/javax/media/j3d/Pipeline.java4
6 files changed, 61 insertions, 25 deletions
diff --git a/src/classes/jogl/javax/media/j3d/JoglPipeline.java b/src/classes/jogl/javax/media/j3d/JoglPipeline.java
index 60364a1..eae3ab2 100644
--- a/src/classes/jogl/javax/media/j3d/JoglPipeline.java
+++ b/src/classes/jogl/javax/media/j3d/JoglPipeline.java
@@ -7633,7 +7633,7 @@ class JoglPipeline extends Pipeline {
}
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBilinearFilter) {
if (VERBOSE) System.err.println("JoglPipeline.textureFillBackground()");
GLContext context = context(ctx);
@@ -7645,6 +7645,13 @@ class JoglPipeline extends Pipeline {
disableAttribFor2D(gl);
gl.glDepthMask(false);
gl.glEnable(GL.GL_TEXTURE_2D);
+
+ /* Setup filter mode if needed */
+ if(useBilinearFilter) {
+ // System.err.println("JoglPipeline - Background : use bilinear filter\n");
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
+ }
// reset the polygon mode
gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL);
@@ -7678,7 +7685,9 @@ class JoglPipeline extends Pipeline {
}
void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha,
+ boolean useBilinearFilter) {
+
if (VERBOSE) System.err.println("JoglPipeline.textureFillRaster()");
GLContext context = context(ctx);
@@ -7689,6 +7698,14 @@ class JoglPipeline extends Pipeline {
GL.GL_CURRENT_BIT );
disableAttribForRaster(gl);
+
+ /* Setup filter mode if needed */
+ if(useBilinearFilter) {
+ // System.err.println("JoglPipeline - Raster : use bilinear filter\n");
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
+ }
+
gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
gl.glColor4f(1.0f, 1.0f, 1.0f, alpha);
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index 62b0463..0758803 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -4503,7 +4503,7 @@ public class Canvas3D extends Canvas {
mapMaxY = 1.0f - ((float) winCoord.y / (float) winHeight);
textureFillRaster(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha, raster.image.useBilinearFilter());
}
@@ -4622,7 +4622,7 @@ public class Canvas3D extends Canvas {
// System.err.println("Java 3D : mapMinX " + mapMinX + " mapMinY " + mapMinY +
// " mapMaxX " + mapMaxX + " mapMaxY " + mapMaxY);
textureFillBackground(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, bg.image.useBilinearFilter());
}
@@ -5050,15 +5050,15 @@ public class Canvas3D extends Canvas {
}
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) {
Pipeline.getPipeline().textureFillBackground(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, useBiliearFilter);
}
void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter) {
Pipeline.getPipeline().textureFillRaster(ctx, texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha, useBiliearFilter);
}
void executeRasterDepth(Context ctx, float posX, float posY, float posZ,
diff --git a/src/classes/share/javax/media/j3d/ImageComponentRetained.java b/src/classes/share/javax/media/j3d/ImageComponentRetained.java
index c0e6e8a..93f477a 100644
--- a/src/classes/share/javax/media/j3d/ImageComponentRetained.java
+++ b/src/classes/share/javax/media/j3d/ImageComponentRetained.java
@@ -48,6 +48,8 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
static final int TYPE_INT_RGB = 0x100;
static final int TYPE_INT_ARGB = 0x200;
+ static final int IMAGE_SIZE_512X512 = 262144;
+
enum ImageFormatType {
TYPE_UNKNOWN,
TYPE_BYTE_BGR,
@@ -308,6 +310,14 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
}
return imageData;
}
+
+ boolean useBilinearFilter() {
+ if(imageDataPowerOfTwo != null) {
+ return true;
+ }
+
+ return false;
+ }
boolean isImageTypeSupported() {
return imageTypeIsSupported;
@@ -1778,9 +1788,11 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
}
void evaluateExtNonPowerOfTwo(int ext) {
-
- int npotWidth;
- int npotHeight;
+ // Only need to enforce for Raster or Background.
+ if(!enforceNonPowerOfTwoSupport) {
+ return;
+ }
+
// If npotSupported is false, a copy power of two image has been created
// so we don't have to check again.
if(!npotSupported) {
@@ -1798,8 +1810,10 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
// NPOT is unsupported, set flag to false.
npotSupported = false;
+ int npotWidth;
+ int npotHeight;
// Always scale up if image size is smaller 512*512.
- if((width * height) < 262144) {
+ if((width * height) < IMAGE_SIZE_512X512) {
npotWidth = getCeilPowerOf2(width);
npotHeight = getCeilPowerOf2(height);
} else {
@@ -1807,7 +1821,7 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
npotHeight = getClosestPowerOf2(height);
}
-// System.err.println("width " + width + " height " + height + " npotWidth " + npotWidth + " npotHeight " + npotHeight);
+ // System.err.println("width " + width + " height " + height + " npotWidth " + npotWidth + " npotHeight " + npotHeight);
float xScale = (float)npotWidth/(float)width;
float yScale = (float)npotHeight/(float)height;
@@ -1840,10 +1854,12 @@ abstract class ImageComponentRetained extends NodeComponentRetained {
AffineTransform at = AffineTransform.getScaleInstance(xScale,
yScale);
+
powerOfTwoATOp = new AffineTransformOp(at,
- AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
- BufferedImage scaledImg = powerOfTwoATOp.filter((BufferedImage)ri, null);
+ AffineTransformOp.TYPE_BILINEAR);
+ BufferedImage scaledImg = powerOfTwoATOp.filter((BufferedImage)ri, null);
+
imageDataPowerOfTwo = createRenderedImageDataObject(null, npotWidth, npotHeight);
// Since ri is created from imageData, it's imageType is supported.
copySupportedImageToImageData(scaledImg, 0, imageDataPowerOfTwo);
diff --git a/src/classes/share/javax/media/j3d/NativePipeline.java b/src/classes/share/javax/media/j3d/NativePipeline.java
index 0eeffc9..bc3f7f4 100644
--- a/src/classes/share/javax/media/j3d/NativePipeline.java
+++ b/src/classes/share/javax/media/j3d/NativePipeline.java
@@ -3060,21 +3060,23 @@ class NativePipeline extends Pipeline {
}
native void textureFillBackground(long ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter);
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) {
textureFillBackground(unbox(ctx), texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, useBiliearFilter);
}
native void textureFillRaster(long ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha,
+ boolean useBiliearFilter);
void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha,
+ boolean useBiliearFilter) {
textureFillRaster(unbox(ctx), texMinU, texMaxU, texMinV, texMaxV,
- mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha);
+ mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ, alpha, useBiliearFilter);
}
native void executeRasterDepth(long ctx, float posX, float posY, float posZ,
diff --git a/src/classes/share/javax/media/j3d/NoopPipeline.java b/src/classes/share/javax/media/j3d/NoopPipeline.java
index 03303d9..53c2756 100644
--- a/src/classes/share/javax/media/j3d/NoopPipeline.java
+++ b/src/classes/share/javax/media/j3d/NoopPipeline.java
@@ -1373,12 +1373,13 @@ class NoopPipeline extends Pipeline {
}
void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter) {
}
void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha) {
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha,
+ boolean useBiliearFilter) {
}
diff --git a/src/classes/share/javax/media/j3d/Pipeline.java b/src/classes/share/javax/media/j3d/Pipeline.java
index 4df8fdb..9d05e0a 100644
--- a/src/classes/share/javax/media/j3d/Pipeline.java
+++ b/src/classes/share/javax/media/j3d/Pipeline.java
@@ -1288,10 +1288,10 @@ abstract class Pipeline {
abstract void clear(Context ctx, float r, float g, float b);
abstract void textureFillBackground(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, boolean useBiliearFilter);
abstract void textureFillRaster(Context ctx, float texMinU, float texMaxU, float texMinV, float texMaxV,
- float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha);
+ float mapMinX, float mapMaxX, float mapMinY, float mapMaxY, float mapZ, float alpha, boolean useBiliearFilter);
abstract void executeRasterDepth(Context ctx, float posX, float posY, float posZ,
int srcOffsetX, int srcOffsetY, int rasterWidth, int rasterHeight, int depthWidth, int depthHeight,