aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent9bb8fe7c2baff185a62cf4806cfa34dfad4f7a4c (diff)
NullGLMediaPlayer: Use low-res PNG instead of TGA texture to save footprint. Move texture to jogl jar/apk for accessibility.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/av/NullGLMediaPlayer.java17
1 files changed, 14 insertions, 3 deletions
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);
}