aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-04-07 07:45:22 +0200
committerSven Gothel <[email protected]>2012-04-07 07:45:22 +0200
commit5aaf3a5cef6f543b64a6e51b3c8578a044cb58ab (patch)
tree55fde9a6b237fa56266b7b0ce5d21eb160af7f48
parent9bb8fe7c2baff185a62cf4806cfa34dfad4f7a4c (diff)
NullGLMediaPlayer: Use low-res PNG instead of TGA texture to save footprint. Move texture to jogl jar/apk for accessibility.
-rw-r--r--make/build-jogl.xml1
-rw-r--r--make/build-test.xml6
-rw-r--r--make/build.xml1
-rw-r--r--make/resources/assets/jogl/util/data/av/test-ntsc01-160x90.pngbin0 -> 2785 bytes
-rw-r--r--make/resources/assets/jogl/util/data/av/test-ntsc01-640x360.tga (renamed from make/resources/assets-test/data/av/test-ntsc01-640x360.tga)bin921644 -> 921644 bytes
-rw-r--r--src/jogl/classes/jogamp/opengl/av/NullGLMediaPlayer.java17
6 files changed, 18 insertions, 7 deletions
diff --git a/make/build-jogl.xml b/make/build-jogl.xml
index 68888c830..804a29b55 100644
--- a/make/build-jogl.xml
+++ b/make/build-jogl.xml
@@ -1669,6 +1669,7 @@
<fileset dir="${classes}"
includes="${java.part.util} ${java.part.util.glsl} ${java.part.util.graph} ${java.part.util.av}"
excludes="${java.part.util.awt} ${java.part.util.gldesktop} ${java.part.util.fixedfuncemu}"/>
+ <fileset dir="resources/assets" includes="jogl/util/**" />
</jar>
<jar manifest="${build.jogl}/manifest.mf" destfile="${jogl.util.fixedfuncemu.jar}" filesonly="true">
<fileset dir="${classes}"
diff --git a/make/build-test.xml b/make/build-test.xml
index a69124672..0a290dcea 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -96,10 +96,8 @@
<!-- get all class files, but skip any resource files that external tools
might have copied into the class directory (otherwise, it's possible
to get the same resource file twice in the jar) -->
- <fileset dir="${classes}"
- includes="${java.part.test}"/>
- <fileset dir="resources/assets-test"
- includes="**" />
+ <fileset dir="${classes}" includes="${java.part.test}"/>
+ <fileset dir="resources/assets-test" includes="**" />
</jar>
</target>
diff --git a/make/build.xml b/make/build.xml
index 24670fcce..5f85f9a6e 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -155,6 +155,7 @@
<target name="android.jogl.package" depends="init,gluegen.cpptasks.detect.os,android.package.jogl.skip.check" if="isAndroid" unless="android.package.jogl.skip">
<aapt.signed
+ assetsdir="resources/assets"
jarsrcdir="${src}/jogl/classes"
jarbuilddir="${jar}"
jarbasename="jogl.all-android"
diff --git a/make/resources/assets/jogl/util/data/av/test-ntsc01-160x90.png b/make/resources/assets/jogl/util/data/av/test-ntsc01-160x90.png
new file mode 100644
index 000000000..3df47432e
--- /dev/null
+++ b/make/resources/assets/jogl/util/data/av/test-ntsc01-160x90.png
Binary files differ
diff --git a/make/resources/assets-test/data/av/test-ntsc01-640x360.tga b/make/resources/assets/jogl/util/data/av/test-ntsc01-640x360.tga
index 71ca3550c..71ca3550c 100644
--- a/make/resources/assets-test/data/av/test-ntsc01-640x360.tga
+++ b/make/resources/assets/jogl/util/data/av/test-ntsc01-640x360.tga
Binary files differ
diff --git a/src/jogl/classes/jogamp/opengl/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/av/NullGLMediaPlayer.java
index 5da135499..c7eb2722c 100644
--- a/src/jogl/classes/jogamp/opengl/av/NullGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/av/NullGLMediaPlayer.java
@@ -29,6 +29,7 @@ package jogamp.opengl.av;
import java.io.IOException;
import java.net.URLConnection;
+import java.nio.ByteBuffer;
import javax.media.opengl.GL;
import javax.media.opengl.GLContext;
@@ -36,6 +37,7 @@ import javax.media.opengl.GLProfile;
import jogamp.opengl.av.GLMediaPlayerImpl;
+import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureData;
@@ -112,9 +114,9 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
@Override
protected void initStreamImplPreGL() throws IOException {
try {
- URLConnection urlConn = IOUtil.getResource("data/av/test-ntsc01-640x360.tga", NullGLMediaPlayer.class.getClassLoader());
+ URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", NullGLMediaPlayer.class.getClassLoader());
if(null != urlConn) {
- texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, "tga");
+ texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, TextureIO.PNG);
}
} catch (Exception e) {
e.printStackTrace();
@@ -125,6 +127,15 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
} else {
width = 640;
height = 480;
+ ByteBuffer buffer = Buffers.newDirectByteBuffer(width*height*4);
+ while(buffer.hasRemaining()) {
+ buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA);
+ }
+ buffer.rewind();
+ texData = new TextureData(GLProfile.getGL2ES2(),
+ GL.GL_RGBA, width, height, 0,
+ GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, false,
+ false, false, buffer, null);
}
fps = 30;
bps = 0;
@@ -141,7 +152,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
@Override
protected TextureFrame createTexImage(GLContext ctx, int idx, int[] tex) {
- Texture texture = super.createTexImageImpl(ctx, idx, tex, true);
+ Texture texture = super.createTexImageImpl(ctx, idx, tex, false);
if(null != texData) {
texture.updateImage(ctx.getGL(), texData);
}