summaryrefslogtreecommitdiffstats
path: root/src/net/java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-02-07 07:01:48 +0000
committerKenneth Russel <[email protected]>2005-02-07 07:01:48 +0000
commitf303d66c1a5c33fa4e392117919af87665dedc2b (patch)
treed750242fb098e376fafd1f712b1b034c760ff7e2 /src/net/java
parent1a4a48f2b5fc3ba7eed815bf1920801f4b0b429d (diff)
Hooked in GKW's Java port of the GLU library's mipmap and image
scaling operations. Added new ForceProcAddressGen directive to GlueGen to force the addresses of the C routines to be fetched even though the functions were being ignored by the core JavaEmitter. Cut down on the number of variants of gluScaleImage and associated routines. Changed the Java signatures of the affected methods to take Buffer again instead of ByteBuffer (as was done during prototyping) to attempt to maintain binary compatibility with current JOGL programs. Fixed bug / problem in gluScaleImage implementation where incorrect scaling of pixel values was being applied in Image.empty_image(); there may be additional problems here for other pixel types. Put debugging code in BuildMipmap under jogl.debug.BuildMipmap System property. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@215 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java')
-rw-r--r--src/net/java/games/gluegen/opengl/GLEmitter.java18
-rw-r--r--src/net/java/games/jogl/impl/mipmap/BuildMipmap.java79
-rw-r--r--src/net/java/games/jogl/impl/mipmap/Image.java4
3 files changed, 64 insertions, 37 deletions
diff --git a/src/net/java/games/gluegen/opengl/GLEmitter.java b/src/net/java/games/gluegen/opengl/GLEmitter.java
index b63d6e8b4..d30f145ab 100644
--- a/src/net/java/games/gluegen/opengl/GLEmitter.java
+++ b/src/net/java/games/gluegen/opengl/GLEmitter.java
@@ -288,6 +288,10 @@ public class GLEmitter extends JavaEmitter
tableWriter.println("public class " + tableClassName);
tableWriter.println("{");
numProcAddressEntries = 0;
+
+ for (Iterator iter = getGLConfig().getForceProcAddressGen().iterator(); iter.hasNext(); ) {
+ emitGLProcAddressTableEntryForString((String) iter.next());
+ }
}
private void endGLProcAddressTable() throws Exception
@@ -331,9 +335,14 @@ public class GLEmitter extends JavaEmitter
protected void emitGLProcAddressTableEntryForSymbol(FunctionSymbol cFunc)
{
+ emitGLProcAddressTableEntryForString(cFunc.getName());
+ }
+
+ protected void emitGLProcAddressTableEntryForString(String str)
+ {
tableWriter.print(" public long ");
tableWriter.print(PROCADDRESS_VAR_PREFIX);
- tableWriter.print(cFunc.getName());
+ tableWriter.print(str);
tableWriter.println(";");
++numProcAddressEntries;
}
@@ -348,6 +357,7 @@ public class GLEmitter extends JavaEmitter
private String tableClassPackage;
private String tableClassName = "ProcAddressTable";
private Set/*<String>*/ skipProcAddressGen = new HashSet();
+ private List/*<String>*/ forceProcAddressGen = new ArrayList();
private String contextVariableName = "context";
private String defaultGetProcAddressTableExpr = ".getGLProcAddressTable()";
private String getProcAddressTableExpr;
@@ -371,6 +381,11 @@ public class GLEmitter extends JavaEmitter
String sym = readString("SkipProcAddressGen", tok, filename, lineNo);
skipProcAddressGen.add(sym);
}
+ else if (cmd.equalsIgnoreCase("ForceProcAddressGen"))
+ {
+ String sym = readString("ForceProcAddressGen", tok, filename, lineNo);
+ forceProcAddressGen.add(sym);
+ }
else if (cmd.equalsIgnoreCase("ContextVariableName"))
{
contextVariableName = readString("ContextVariableName", tok, filename, lineNo);
@@ -399,6 +414,7 @@ public class GLEmitter extends JavaEmitter
public String tableClassPackage() { return tableClassPackage; }
public String tableClassName() { return tableClassName; }
public boolean skipProcAddressGen (String name) { return skipProcAddressGen.contains(name); }
+ public List getForceProcAddressGen() { return forceProcAddressGen; }
public String contextVariableName() { return contextVariableName; }
public String getProcAddressTableExpr() {
if (getProcAddressTableExpr == null) {
diff --git a/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java b/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java
index b9f4e7ab6..fd225a439 100644
--- a/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java
+++ b/src/net/java/games/jogl/impl/mipmap/BuildMipmap.java
@@ -36,6 +36,7 @@ package net.java.games.jogl.impl.mipmap;
import net.java.games.jogl.GL;
import net.java.games.jogl.GLU;
+import net.java.games.jogl.impl.Debug;
import java.nio.*;
import java.io.*;
@@ -44,7 +45,9 @@ import java.io.*;
* @author Administrator
*/
public class BuildMipmap {
-
+
+ private static boolean DEBUG = Debug.debug("BuildMipmap");
+
/** Creates a new instance of BuildMipmap */
public BuildMipmap() {
}
@@ -694,19 +697,23 @@ public class BuildMipmap {
gl.glPixelStorei( GL.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE );
if( baseLevel <= level && level <= maxLevel ) {
srcImage.rewind();
- System.err.println("GL Error(" + level + "): " + gl.glGetError() );
+ if (DEBUG) {
+ System.err.println("GL Error(" + level + "): " + gl.glGetError() );
+ }
gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage );
- System.err.println("GL Error(" + level + "): " + gl.glGetError() );
- try {
- File file = new File( "glu2DMipmapJ" + level + ".bin" );
- FileOutputStream fos = new FileOutputStream( file );
- srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) );
- fos.getChannel().write( srcImage );
- srcImage.clear();
- fos.close();
- } catch( IOException e ) {
- System.err.println("IOException");
- System.err.println(e.getMessage());
+ if (DEBUG) {
+ System.err.println("GL Error(" + level + "): " + gl.glGetError() );
+ try {
+ File file = new File( "glu2DMipmapJ" + level + ".bin" );
+ FileOutputStream fos = new FileOutputStream( file );
+ srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) );
+ fos.getChannel().write( srcImage );
+ srcImage.clear();
+ fos.close();
+ } catch( IOException e ) {
+ System.err.println("IOException");
+ System.err.println(e.getMessage());
+ }
}
}
@@ -800,16 +807,18 @@ public class BuildMipmap {
if( baseLevel <= level && level <= maxLevel ) {
srcImage.rewind();
gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage );
- System.err.println("GL Error(" + level + "): " + gl.glGetError() );
- try {
- File file = new File( "glu2DMipmapJ" + level + ".bin" );
- FileOutputStream fos = new FileOutputStream( file );
- srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) );
- fos.getChannel().write( srcImage );
- srcImage.clear();
- } catch( IOException e ) {
- System.err.println("IOException");
- System.err.println(e.getMessage());
+ if (DEBUG) {
+ System.err.println("GL Error(" + level + "): " + gl.glGetError() );
+ try {
+ File file = new File( "glu2DMipmapJ" + level + ".bin" );
+ FileOutputStream fos = new FileOutputStream( file );
+ srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) );
+ fos.getChannel().write( srcImage );
+ srcImage.clear();
+ } catch( IOException e ) {
+ System.err.println("IOException");
+ System.err.println(e.getMessage());
+ }
}
}
} else {
@@ -844,16 +853,18 @@ public class BuildMipmap {
if( baseLevel <= level && level <= maxLevel ) {
newMipmapImage.rewind();
gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, newMipmapImage );
- System.err.println("GL Error: " + gl.glGetError() );
- try {
- File file = new File( "glu2DMipmapJ" + level + ".bin" );
- FileOutputStream fos = new FileOutputStream( file );
- srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) );
- fos.getChannel().write( newMipmapImage );
- srcImage.clear();
- } catch( IOException e ) {
- System.err.println("IOException");
- System.err.println(e.getMessage());
+ if (DEBUG) {
+ System.err.println("GL Error: " + gl.glGetError() );
+ try {
+ File file = new File( "glu2DMipmapJ" + level + ".bin" );
+ FileOutputStream fos = new FileOutputStream( file );
+ srcImage.limit( Mipmap.image_size( newwidth, newheight, format, type ) );
+ fos.getChannel().write( newMipmapImage );
+ srcImage.clear();
+ } catch( IOException e ) {
+ System.err.println("IOException");
+ System.err.println(e.getMessage());
+ }
}
}
}
@@ -1630,4 +1641,4 @@ public class BuildMipmap {
gl.glPixelStorei( GL.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() );
return( 0 );
}
-} \ No newline at end of file
+}
diff --git a/src/net/java/games/jogl/impl/mipmap/Image.java b/src/net/java/games/jogl/impl/mipmap/Image.java
index b0d54bfc0..1ea3b1f52 100644
--- a/src/net/java/games/jogl/impl/mipmap/Image.java
+++ b/src/net/java/games/jogl/impl/mipmap/Image.java
@@ -529,7 +529,7 @@ public class Image {
userdata.put( iter, (byte)oldimage.get(iter2++) );
} else {
//userdata[iter] = (byte)( oldimage[iter2++] >> 8 );
- userdata.put( iter, (byte)( oldimage.get(iter2++) >> 8 ) );
+ userdata.put( iter, (byte)( oldimage.get(iter2++) ) );
}
break;
case( GL.GL_BYTE ):
@@ -538,7 +538,7 @@ public class Image {
userdata.put( iter, (byte)oldimage.get(iter2++) );
} else {
//userdata[iter] = (byte)( oldimage[iter2++] >> 9 );
- userdata.put( iter, (byte)( oldimage.get(iter2++) >> 9 ) );
+ userdata.put( iter, (byte)( oldimage.get(iter2++) ) );
}
break;
case( GL.GL_UNSIGNED_SHORT_5_6_5 ):