summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2015-10-15 20:13:59 +0200
committerSven Gothel <sgothel@jausoft.com>2015-10-15 20:13:59 +0200
commita872884aca5765695d6e385625274764df83637a (patch)
tree3a1e4396c4b687ec0003e7319cdf9b8ea2c64064
parent7a4f9fe683cabff00e941fd3cd8a257822e21923 (diff)
Adapt to GlueGen commit acd52a1936090eee11b3220f5c75ee37763773c7
-rw-r--r--src/demos/dualDepthPeeling/Model.java42
-rwxr-xr-xsrc/demos/es2/perftst/PerfTextLoad.java37
2 files changed, 44 insertions, 35 deletions
diff --git a/src/demos/dualDepthPeeling/Model.java b/src/demos/dualDepthPeeling/Model.java
index c67c9b1..8f3a2b6 100644
--- a/src/demos/dualDepthPeeling/Model.java
+++ b/src/demos/dualDepthPeeling/Model.java
@@ -70,7 +70,7 @@ public class Model {
Integer pIndex = 0;
Integer nIndex = 0;
- boolean lessThan ( IdxSet rhs )
+ boolean lessThan ( IdxSet rhs )
{
if (pIndex < rhs.pIndex)
return true;
@@ -95,7 +95,7 @@ public class Model {
//
//////////////////////////////////////////////////////////////
public boolean loadModelFromFile( Class<?> context, String file ) {
- URLConnection conn = IOUtil.getResource(context, file);
+ URLConnection conn = IOUtil.getResource(file, context.getClassLoader(), context);
if ( conn != null )
{
BufferedReader input = null;
@@ -146,18 +146,18 @@ public class Model {
case 'f':
//face
line = line.substring( line.indexOf( " " ) + 2 );
-
+
idx[0][0] = Integer.valueOf( line.substring( 0, line.indexOf("//") ) ).intValue();
line = line.substring( line.indexOf( "//" ) + 2 );
idx[0][1] = Integer.valueOf( line.substring( 0, line.indexOf(" ") ) ).intValue();
- {
+ {
//This face has vertex and normal indices
// in .obj, f v1 .... the vertex index used start from 1, so -1 here
//remap them to the right spot
- idx[0][0] = (idx[0][0] > 0) ? (idx[0][0] - 1) : ((int)positions_.size() - idx[0][0]);
- idx[0][1] = (idx[0][1] > 0) ? (idx[0][1] - 1) : ((int)normals_.size() - idx[0][1]);
+ idx[0][0] = (idx[0][0] > 0) ? (idx[0][0] - 1) : (positions_.size() - idx[0][0]);
+ idx[0][1] = (idx[0][1] > 0) ? (idx[0][1] - 1) : (normals_.size() - idx[0][1]);
//grab the second vertex to prime
line = line.substring( line.indexOf( " " ) + 1 );
@@ -166,8 +166,8 @@ public class Model {
idx[1][1] = Integer.valueOf( line.substring( 0, line.indexOf(" ") ) );
//remap them to the right spot
- idx[1][0] = (idx[1][0] > 0) ? (idx[1][0] - 1) : ((int)positions_.size() - idx[1][0]);
- idx[1][1] = (idx[1][1] > 0) ? (idx[1][1] - 1) : ((int)normals_.size() - idx[1][1]);
+ idx[1][0] = (idx[1][0] > 0) ? (idx[1][0] - 1) : (positions_.size() - idx[1][0]);
+ idx[1][1] = (idx[1][1] > 0) ? (idx[1][1] - 1) : (normals_.size() - idx[1][1]);
//grab the third vertex to prime
line = line.substring( line.indexOf( " " ) + 1 );
@@ -176,8 +176,8 @@ public class Model {
idx[2][1] = Integer.valueOf( line );
{
//remap them to the right spot
- idx[2][0] = (idx[2][0] > 0) ? (idx[2][0] - 1) : ((int)positions_.size() - idx[2][0]);
- idx[2][1] = (idx[2][1] > 0) ? (idx[2][1] - 1) : ((int)normals_.size() - idx[2][1]);
+ idx[2][0] = (idx[2][0] > 0) ? (idx[2][0] - 1) : (positions_.size() - idx[2][0]);
+ idx[2][1] = (idx[2][1] > 0) ? (idx[2][1] - 1) : (normals_.size() - idx[2][1]);
//add the indices
for (int ii = 0; ii < 3; ii++) {
@@ -195,8 +195,8 @@ public class Model {
default:
break;
- };
- }
+ };
+ }
//post-process data
//free anything that ended up being unused
if (!hasNormals) {
@@ -206,7 +206,7 @@ public class Model {
posSize_ = 3;
return true;
-
+
} catch (FileNotFoundException kFNF) {
System.err.println("Unable to find the shader file " + file);
} catch (IOException kIO) {
@@ -230,7 +230,7 @@ public class Model {
// combination of position, normal, tex coords, etc that are
// used in the model. The prim parameter, tells the model
// what type of index list to compile. By default it compiles
- // a simple triangle mesh with no connectivity.
+ // a simple triangle mesh with no connectivity.
//
public void compileModel( )
{
@@ -254,7 +254,7 @@ public class Model {
pts.put( idx, pts.size() );
- //position,
+ //position,
vertices_.put( positions_.elementAt(idx.pIndex*posSize_));
vertices_.put( positions_.elementAt(idx.pIndex*posSize_ + 1));
vertices_.put( positions_.elementAt(idx.pIndex*posSize_ + 2));
@@ -267,7 +267,7 @@ public class Model {
}
}
- else {
+ else {
if (needsTriangles)
indices_.put( pts.get(idx) );
}
@@ -300,7 +300,7 @@ public class Model {
{
if ( positions_.isEmpty())
return;
-
+
for ( int i = 0; i < 3; i++ )
{
minVal[i] = 1e10f;
@@ -359,15 +359,15 @@ public class Model {
}
public int getPositionCount() {
- return (posSize_ > 0) ? (int)positions_.size() / posSize_ : 0;
+ return (posSize_ > 0) ? positions_.size() / posSize_ : 0;
}
public int getNormalCount() {
- return (int)normals_.size() / 3;
+ return normals_.size() / 3;
}
public int getIndexCount() {
- return (int)pIndex_.size();
+ return pIndex_.size();
}
public FloatBuffer getCompiledVertices() {
@@ -414,7 +414,7 @@ public class Model {
//data structures optimized for rendering, compiled model
IntBuffer indices_ = null;
- FloatBuffer vertices_ = null;
+ FloatBuffer vertices_ = null;
int pOffset_;
int nOffset_;
int vtxSize_ = 0;
diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java
index 4b7aadf..971ab32 100755
--- a/src/demos/es2/perftst/PerfTextLoad.java
+++ b/src/demos/es2/perftst/PerfTextLoad.java
@@ -1,14 +1,21 @@
package demos.es2.perftst;
-import com.jogamp.common.util.IOUtil;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLConnection;
+import java.nio.FloatBuffer;
-import java.nio.*;
-import java.io.*;
-import java.net.*;
-import com.jogamp.opengl.*;
-import com.jogamp.opengl.util.*;
+import com.jogamp.common.util.IOUtil;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLUniformData;
+import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.glsl.ShaderState;
-import com.jogamp.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
public class PerfTextLoad extends PerfModule {
static final int MAX_TEXTURE_ENGINES = 8;
@@ -16,7 +23,8 @@ public class PerfTextLoad extends PerfModule {
public PerfTextLoad() {
}
- public ShaderState initShaderState(GL2ES2 gl) {
+ @Override
+ public ShaderState initShaderState(GL2ES2 gl) {
return initShaderState(gl, "vbo-vert-text", "ftext");
}
@@ -36,7 +44,7 @@ public class PerfTextLoad extends PerfModule {
try {
for(int i=0; i<numObjs; i++) {
textName = "data/"+textBaseName+"."+(i+1)+".tga";
- URLConnection connText = IOUtil.getResource(Perftst.class, textName);
+ URLConnection connText = IOUtil.getResource(textName, Perftst.class.getClassLoader(), Perftst.class);
if(connText==null) {
throw new RuntimeException("couldn't fetch "+textName);
}
@@ -58,7 +66,7 @@ public class PerfTextLoad extends PerfModule {
throw new RuntimeException(ioe);
}
- //
+ //
// Vertices Data setup
//
@@ -97,8 +105,8 @@ public class PerfTextLoad extends PerfModule {
GLUniformData activeTexture = new GLUniformData("mgl_ActiveTexture", 0);
st.uniform(gl, activeTexture);
-
- //
+
+ //
// run loops
//
@@ -168,7 +176,7 @@ public class PerfTextLoad extends PerfModule {
System.out.println("Texture "+textBaseName+", loops "+loops+", textures "+numTextures+", objects "+numObjs+
", total bytes "+textBytes+", total time: "+dt +
"ms, fps(-1): "+(((loops-1)*numObjs*1000)/dt)+
- ",\n text kB/s: " + ( ((double)(loops*textBytes)/1024.0) / ((double)dt/1000.0) ) );
+ ",\n text kB/s: " + ( (loops*textBytes/1024.0) / (dt/1000.0) ) );
for(int i=0; i<loops; i++) {
dtC = 0;
@@ -213,7 +221,8 @@ public class PerfTextLoad extends PerfModule {
System.gc();
}
- public void run(GLAutoDrawable drawable, int loops) {
+ @Override
+ public void run(GLAutoDrawable drawable, int loops) {
runOneSet(drawable, "bob2.64x64", 33, 1, loops);
runOneSet(drawable, "bob2.128x128", 33, 1, loops);
runOneSet(drawable, "bob2.128x128", 4, 1, loops);