diff options
-rw-r--r-- | src/classes/jogl/javax/media/j3d/JoglPipeline.java | 21 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/Canvas3D.java | 12 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/ImageComponentRetained.java | 30 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/NativePipeline.java | 14 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/NoopPipeline.java | 5 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/Pipeline.java | 4 | ||||
-rw-r--r-- | src/native/d3d/Canvas3D.cpp | 44 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.cpp | 6 | ||||
-rw-r--r-- | src/native/d3d/GraphicsContext3D.cpp | 2 | ||||
-rw-r--r-- | src/native/ogl/Canvas3D.c | 50 |
10 files changed, 140 insertions, 48 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, diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp index dbe7042..ea84d95 100644 --- a/src/native/d3d/Canvas3D.cpp +++ b/src/native/d3d/Canvas3D.cpp @@ -352,7 +352,8 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( jfloat mapMinX, jfloat mapMaxX, jfloat mapMinY, - jfloat mapMaxY) + jfloat mapMaxY, + jboolean useBilinearFilter) { DWORD alphaTest, alphaBlend, cull, zBuffer, @@ -398,12 +399,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( d3dCtx->texUnitStage, d3dCtx->bindTextureIdLen); } return; - } - - device->SetTextureStageState(tus, - D3DTSS_TEXCOORDINDEX, - D3DTSS_TCI_PASSTHRU); - + } if (d3dCtx->texTransformSet[tus]) { device->GetTransform((D3DTRANSFORMSTATETYPE) @@ -415,6 +411,24 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( &identityMatrix); } + // TextureStage will be restore by caller. + device->SetTextureStageState(tus, + D3DTSS_TEXCOORDINDEX, + D3DTSS_TCI_PASSTHRU); + + /* Setup filter mode if needed */ + if(useBilinearFilter) { + /* fprintf(stderr, "Background : use bilinear filter\n"); */ + device->SetSamplerState (tus, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); + device->SetSamplerState (tus, D3DSAMP_MIPFILTER, D3DTEXF_POINT); + device->SetSamplerState (tus, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); + } + /* For debugging only + else { + fprintf(stderr, "Background : Not use bilinear filter\n"); + } + */ + device->GetTransform(D3DTS_PROJECTION, &ptm); device->GetTransform(D3DTS_WORLD, &wtm); device->GetTransform(D3DTS_VIEW, &vtm); @@ -526,7 +540,8 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env, jfloat mapMinY, jfloat mapMaxY, jfloat mapZ, - jfloat alpha) + jfloat alpha, + jboolean useBilinearFilter) { DWORD cull, lighting; @@ -558,6 +573,19 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env, device->SetTextureStageState(tus, D3DTSS_ALPHAOP, D3DTOP_MODULATE); device->SetTextureStageState(tus, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); device->SetTextureStageState(tus, D3DTSS_ALPHAARG2, D3DTA_CURRENT); + + /* Setup filter mode if needed */ + if(useBilinearFilter) { + /* fprintf(stderr, "Raster : use bilinear filter\n"); */ + device->SetSamplerState (tus, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); + device->SetSamplerState (tus, D3DSAMP_MIPFILTER, D3DTEXF_POINT); + device->SetSamplerState (tus, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); + } + /* For debugging only + else { + fprintf(stderr, "Raster : Not use bilinear filter\n"); + } + */ device->GetTransform(D3DTS_PROJECTION, &ptm); device->GetTransform(D3DTS_WORLD, &wtm); diff --git a/src/native/d3d/D3dUtil.cpp b/src/native/d3d/D3dUtil.cpp index 6b5c1df..55e6ded 100644 --- a/src/native/d3d/D3dUtil.cpp +++ b/src/native/d3d/D3dUtil.cpp @@ -941,7 +941,7 @@ void copyDataFromSurface(jint imageFormat, dstPitch = subWidth << 2; destRow += (subHeight-1)*dstPitch; - printf("[Java 3D] copyDataFromSurface: (1) %d\n", ddpf.dwRGBBitCount); + /* printf("[Java 3D] copyDataFromSurface: (1) %d\n", ddpf.dwRGBBitCount); */ if ((ddpf.dwRGBBitCount == 32) && (ddpf.dwRBitMask == 0xff0000) && @@ -1044,14 +1044,14 @@ void copyDataFromSurface(jint imageFormat, destRow -= dstPitch; } } else if (ddpf.dwRGBBitCount <= 8) { - printf("[Java 3D] copyDataFromSurface: Format on (8 bits or less surface) not support %d\n", imageFormat); + /* printf("[Java 3D] copyDataFromSurface: Format on (8 bits or less surface) not support %d\n", imageFormat); */ } } } else if ((imageFormat == IMAGE_FORMAT_BYTE_RGBA) || (imageFormat == IMAGE_FORMAT_BYTE_RGB) || (imageFormat == IMAGE_FORMAT_INT_BGR)) { - printf("[Java 3D] copyDataFromSurface: (2) %d\n", ddpf.dwRGBBitCount); + /* printf("[Java 3D] copyDataFromSurface: (2) %d\n", ddpf.dwRGBBitCount); */ dstPitch = subWidth << 2; destRow += (subHeight-1)*dstPitch; diff --git a/src/native/d3d/GraphicsContext3D.cpp b/src/native/d3d/GraphicsContext3D.cpp index 3b4f018..052e80e 100644 --- a/src/native/d3d/GraphicsContext3D.cpp +++ b/src/native/d3d/GraphicsContext3D.cpp @@ -26,7 +26,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_readRaster( GetDevice(); - printf("[GraphicsContext3D] readRaster ...\n"); + /* printf("[GraphicsContext3D] readRaster ...\n"); */ if ((type & javax_media_j3d_Raster_RASTER_COLOR) != 0) { diff --git a/src/native/ogl/Canvas3D.c b/src/native/ogl/Canvas3D.c index c8a8db1..e1bcb83 100644 --- a/src/native/ogl/Canvas3D.c +++ b/src/native/ogl/Canvas3D.c @@ -378,7 +378,7 @@ checkTextureExtensions( ctxInfo->textureExtMask |= javax_media_j3d_Canvas3D_TEXTURE_LOD_OFFSET; } - + if (isExtensionSupported(tmpExtensionStr, "GL_ARB_texture_non_power_of_two")) { ctxInfo->textureNonPowerOfTwoAvailable = JNI_TRUE; @@ -386,6 +386,7 @@ checkTextureExtensions( javax_media_j3d_Canvas3D_TEXTURE_NON_POWER_OF_TWO; } + } jboolean @@ -650,7 +651,7 @@ getPropertiesFromCurrentContext( ctxInfo->texture_max_level_enum = GL_TEXTURE_MAX_LEVEL; - /* look for OpenGL 2.0 features */ + /* look for OpenGL 2.0 features */ if (ctxInfo->gl20) { ctxInfo->textureNonPowerOfTwoAvailable = JNI_TRUE; ctxInfo->textureExtMask |= @@ -1355,10 +1356,10 @@ void JNICALL Java_javax_media_j3d_NativePipeline_texturemapping( glDepthMask(GL_FALSE); glBindTexture(GL_TEXTURE_2D, objectId); /* set up texture parameter */ - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); #ifdef VERBOSE glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); @@ -1492,7 +1493,8 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground(JNIEnv *e jfloat mapMinX, jfloat mapMaxX, jfloat mapMinY, - jfloat mapMaxY) + jfloat mapMaxY, + jboolean useBilinearFilter ) { JNIEnv table; GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo; @@ -1510,6 +1512,18 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground(JNIEnv *e glDepthMask(GL_FALSE); glEnable(GL_TEXTURE_2D); + /* Setup filter mode if needed */ + if(useBilinearFilter) { + /* fprintf(stderr, "Background : use bilinear filter\n"); */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + /* For debugging only + else { + fprintf(stderr, "Background : Not use bilinear filter\n"); + } + */ + /* reset the polygon mode */ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); @@ -1564,7 +1578,8 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env, jfloat mapMinY, jfloat mapMaxY, jfloat mapZ, - jfloat alpha) + jfloat alpha, + jboolean useBilinearFilter ) { JNIEnv table; GraphicsContextPropertiesInfo *ctxProperties = (GraphicsContextPropertiesInfo *)ctxInfo; @@ -1578,11 +1593,24 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFillRaster(JNIEnv *env, /* Temporarily disable fragment and most 3D operations */ glPushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_POLYGON_BIT | GL_CURRENT_BIT); - + disableAttribForRaster(ctxProperties); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glColor4f(1.0f, 1.0f, 1.0f, (float) alpha); + /* Setup filter mode if needed */ + if(useBilinearFilter) { + /* fprintf(stderr, "Raster : use bilinear filter\n"); */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + /* For debugging only + else { + fprintf(stderr, "Raster : Not use bilinear filter\n"); + } + */ + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glColor4f(1.0f, 1.0f, 1.0f, (float) alpha); + /* reset the polygon mode */ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); |