VisClient/org/hfbk/vid/VideoTexture.java

Go to the documentation of this file.
00001 package org.hfbk.vid;
00002 
00003 import java.nio.ByteBuffer;
00004 
00005 import org.dronus.gl.Texture;
00006 import org.lwjgl.opengl.GL11;
00007 
00013 public class VideoTexture extends Texture
00014 {
00015 
00016         public AVStreamingThread streamer;
00017         
00018         //set currenttime negative to enforce first frame even if video is stopped. 
00019         long time;
00020         public long currenttime=-1;
00021         
00030         public VideoTexture(AVStreamingThread streamer) {
00031                 super(streamer.videoThread.width, streamer.videoThread.height, GL11.GL_RGB, false);
00032 
00033                 this.streamer=streamer;
00034     }
00035 
00044         public void render(float dt){
00045                 
00046                 ByteBuffer frame=streamer.getFrame(dt);
00047                 if (frame!=null){
00048                         setPixels(frame, width, height);
00049                 }
00050                 
00051         super.render();
00052         }
00053         
00057         public void render(){
00058                 render(40);
00059         }
00060 
00062         public void close(){
00063                 streamer.running=false;
00064         }
00065         
00066         protected void finalize() throws Throwable {
00067                 close();                
00068         }
00069 }

Generated on Tue Apr 7 17:57:20 2009 for visclient by  doxygen 1.5.1