From 4ccc754cfb90bbcc8393ec1c6b8f593fc2cce751 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 30 Aug 2008 07:46:46 +0000 Subject: PerfTextLoad (wip) git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@283 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/es2/perftst/PerfTextLoad.java | 185 +++++++++++++++++--------------- src/demos/es2/perftst/data/bob2.gif | Bin 0 -> 23146 bytes src/demos/es2/perftst/data/gif2tgas.sh | 28 +++++ src/demos/es2/perftst/shader/ftext.fp | 4 +- 4 files changed, 132 insertions(+), 85 deletions(-) create mode 100644 src/demos/es2/perftst/data/bob2.gif create mode 100644 src/demos/es2/perftst/data/gif2tgas.sh (limited to 'src') diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java index c250863..532b3b7 100755 --- a/src/demos/es2/perftst/PerfTextLoad.java +++ b/src/demos/es2/perftst/PerfTextLoad.java @@ -1,19 +1,19 @@ package demos.es2.perftst; import java.nio.*; +import java.io.*; +import java.net.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.glsl.*; +import com.sun.opengl.util.texture.*; +import com.sun.opengl.util.io.*; import com.sun.javafx.newt.*; public class PerfTextLoad extends PerfModule { - static final int MAX_ARRAYS = 12; - static final int MAX_ARRAY_ELEM = 16; + static final int MAX_TEXTURE_ENGINES = 8; - GLUniformData[] dummyA, dummyB, dummyC; - final int dataType=GL.GL_FLOAT; - public PerfTextLoad() { } @@ -21,68 +21,77 @@ public class PerfTextLoad extends PerfModule { initShaderState(gl, "vbo-vert-text", "ftext"); } - protected void runOneSet(GLAutoDrawable drawable, int numObjs, int numArrayElem, int loops) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + Texture[] textures = null; + TextureData[] textDatas = null; - // - // Vertices Data setup - // + protected void runOneSet(GLAutoDrawable drawable, String textBaseName, int numObjs, int numTextures, int loops) { + GL2ES2 gl = drawable.getGL().getGL2ES2(); - if(numObjs>MAX_ARRAYS) { - throw new GLException("numObjs must be within 0.."+MAX_ARRAYS); + if(numTextures>MAX_TEXTURE_ENGINES) { + throw new GLException("numTextures must be within 1.."+MAX_TEXTURE_ENGINES); } - if(numArrayElem>MAX_ARRAY_ELEM) { - throw new GLException("numArrayElem must be within 0.."+MAX_ARRAY_ELEM); + String textName = null; + textDatas = new TextureData[numObjs]; + textures = new Texture[numTextures]; + try { + for(int i=0; i1f) { x=0f; y=0f; z+=0.01f; } - } - fb.flip(); - - dummyUni[i] = new GLUniformData("mgl_Dummy"+i, 4, fb); + long[] tU = new long[numObjs+1]; + tU[0] = System.currentTimeMillis(); + for(int j=0; j8) { - runOneSet(drawable, MAX_ARRAYS, 1, loops); - runOneSet(drawable, 1, MAX_ARRAYS, loops); - } - runOneSet(drawable, 1, 16, loops); - - runOneSet(drawable, 2, 16, loops); - runOneSet(drawable, 4, 16, loops); - runOneSet(drawable, 8, 16, loops); - if(MAX_ARRAYS>8) { - runOneSet(drawable, MAX_ARRAYS, 16, loops); - } + runOneSet(drawable, "bob2.64x64", 33, 1, loops); + //runOneSet(drawable, "bob2.128x128", 33, 1, loops); + //runOneSet(drawable, "bob2.256x256", 33, 1, loops); } } diff --git a/src/demos/es2/perftst/data/bob2.gif b/src/demos/es2/perftst/data/bob2.gif new file mode 100644 index 0000000..2faba51 Binary files /dev/null and b/src/demos/es2/perftst/data/bob2.gif differ diff --git a/src/demos/es2/perftst/data/gif2tgas.sh b/src/demos/es2/perftst/data/gif2tgas.sh new file mode 100644 index 0000000..2fd184b --- /dev/null +++ b/src/demos/es2/perftst/data/gif2tgas.sh @@ -0,0 +1,28 @@ +#! /bin/sh + +rm -rf tmp +mkdir -p tmp + +function gif2tga() +{ + bname=$1 + shift + images=$1 + shift + xysize=$1 + shift + + i=1 ; + while [ $i -le $images ] ; do + giftopnm -image $i $bname.gif > tmp/$bname.$i.pnm + pamscale -xsize=$xysize -ysize=$xysize tmp/$bname.$i.pnm > tmp/$bname.$xysize"x"$xysize.$i.pam + pamtotga -rgb -norle tmp/$bname.$xysize"x"$xysize.$i.pam > $bname.$xysize"x"$xysize.$i.tga + let i=$i+1 + done +} + +gif2tga bob2 33 64 +gif2tga bob2 33 128 +gif2tga bob2 33 256 +gif2tga bob2 33 512 + diff --git a/src/demos/es2/perftst/shader/ftext.fp b/src/demos/es2/perftst/shader/ftext.fp index d9bb6df..1bd251b 100644 --- a/src/demos/es2/perftst/shader/ftext.fp +++ b/src/demos/es2/perftst/shader/ftext.fp @@ -8,9 +8,11 @@ #endif varying vec4 mgl_TexCoord0; +uniform sampler2D mgl_ActiveTexture; void main (void) { - gl_FragColor = vec4(texture2D(0, mgl_TexCoord0.st).rgb, 1.0); + // gl_FragColor = vec4(texture2D(mgl_ActiveTexture, mgl_TexCoord0.st).rgb, 1.0); + gl_FragColor = vec4(0.2, 0.2, 0.2, 1.0) + vec4(texture2D(mgl_ActiveTexture, mgl_TexCoord0.st).rgb, 1.0); } -- cgit v1.2.3