diff options
author | Sven Gothel <[email protected]> | 2012-03-17 21:48:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-17 21:48:22 +0100 |
commit | 5f23b0ca30316804c5065366c631c8290af4c29f (patch) | |
tree | bf0f57c89bea10b85ab711a2e79664f2e6650233 /src/demos/es2 | |
parent | 87470a5a0d41c3eb1e54da1c388c4f56283bd9b1 (diff) |
Adapt to GlueGen IO resource changes URL -> URLConnection for effeciency
Diffstat (limited to 'src/demos/es2')
-rwxr-xr-x | src/demos/es2/perftst/PerfTextLoad.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java index f603796..543ce93 100755 --- a/src/demos/es2/perftst/PerfTextLoad.java +++ b/src/demos/es2/perftst/PerfTextLoad.java @@ -9,9 +9,6 @@ import javax.media.opengl.*; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.texture.*; -import com.jogamp.newt.*; -import com.jogamp.newt.opengl.*; - public class PerfTextLoad extends PerfModule { static final int MAX_TEXTURE_ENGINES = 8; @@ -38,12 +35,17 @@ public class PerfTextLoad extends PerfModule { try { for(int i=0; i<numObjs; i++) { textName = "data/"+textBaseName+"."+(i+1)+".tga"; - URL urlText = IOUtil.getResource(Perftst.class, textName); - if(urlText==null) { + URLConnection connText = IOUtil.getResource(Perftst.class, textName); + if(connText==null) { throw new RuntimeException("couldn't fetch "+textName); } - textDatas[i] = TextureIO.newTextureData(gl.getGLProfile(), urlText.openStream(), false, TextureIO.TGA); - System.out.println(textBaseName+": "+textDatas[i]); + final InputStream in = connText.getInputStream(); + try { + textDatas[i] = TextureIO.newTextureData(gl.getGLProfile(), in, false, TextureIO.TGA); + System.out.println(textBaseName+": "+textDatas[i]); + } finally { + IOUtil.close(in, false); + } } for(int i=0; i<numTextures; i++) { |