public void frameUpdate(float timePerFrame) { // TODO Auto-generated method stub // TODO Play Frame, when in the right time => Sync-Playback-rate /* * // Put A Frame according to its Framerate * TODO: Declare private long controller; private long frameWait; private long starttime; private int iteration; Initialize starttime = System.currentTimeMillis(); controller = System.currentTimeMillis(); frameWait = 1000 / perf.getFramerate(); iteration = 0; This one into the update function: if (System.currentTimeMillis() >= (controller + frameWait)){ controller = System.currentTimeMillis(); System.out.println("There you go: " + System.currentTimeMillis()); drawFrame(); iteration++; } if (System.currentTimeMillis() > (starttime + (iteration*frameWait)+frameWait)) { // skip Frame iteration += 2; System.out.println("Look ma, no hands: " + iteration); } */ // timer.getTimePerFrame(); if (oggDecoder.isReady()) { oggDecoder.readBody(); TextureManager.releaseTexture(texture.getTextureKey()); texture = TextureManager.loadTexture( Toolkit.getDefaultToolkit().createImage(oggDecoder.getYUVBuffer()), MinificationFilter.BilinearNearestMipMap, MagnificationFilter.Bilinear, true); if (texture != null) { if (textureState != null) textureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState(); textureState.setTexture(texture); quad.setRenderState(textureState); quad.updateRenderState(); } } }
public VideoTexture(String name, String file) { super(name); // getInputStreamFromFile(file); this.file = file; getInputStream(file); if (inputStream == null) { System.err.println("InputStream is empty!"); } else { createShape(); oggDecoder = new OggDecoder(inputStream); oggDecoder.start(); } }