GSVideo with alpha channel

Hi ,my first post in processing forum :) I'm new to processing . I'm trying to do exactly what this thread asks : http://forum.processing.org/one/topic/gsvideo-with-alpha-channel.html , which is showing a video with alpha channel . this thread suggests that GSvideo is able to work with alpha channel. I'm writing the exact code in that thread :

import processing.opengl.*;
import codeanticode.gsvideo.*;
import codeanticode.glgraphics.*;

public class BGvideo {

  GSMovie myMovie;
  GLTexture tex;

  public BGvideo (String videoFile, PApplet app) {

    app.registerDraw(this); 

    myMovie = new GSMovie(app, videoFile );
    tex = new GLTexture(app);
    myMovie.setPixelDest(tex);
    myMovie.loop();
  }
  public void setup(){
    size(1920,720,GLConstants.GLGRAPHICS);
  }
  public void draw () {
    myMovie.read();
    if (tex.putPixelsIntoTexture()) {
      background(255, 0, 0);
      image(tex, 0, 0, 1920, 487);
    }
  }
}

void draw(){
  background(255,0,0);
  BGvideo bgv = new BGvideo("myMovie.mov",app);
}

but I get the error : "Cannot find anything named "app" ". and in the other forum the creator of the above code akiersky says : " 'app' was a variable I was using to set the root PApplet in my application. for your example, just change it to 'this' and it should work. The class, or more specifically, GSVideo needs a PApplet to send it's movieEvent to, so I pass the main PApplet into the class then it can pass it along. " I replaced "app" with this but then I get this error : "ClassCastException: processing.core.PGraphics.Java2D cannot be cast to processing.opengl.PGraphicsOpenGL" . I'll appreciate if someone can help me with this. thanks very much

Answers

  • You have to replace app by this only in the last line, in case it wasn't clear.

    And for the last error, this is because you have GLConstants.GLGRAPHICS in the size() call, you should remove it, I think.

  • Thanks @Phil.ho . I have tried those things . As I have said if I replace the "app" in line 33 with "this" it gives me error "ClassCastException: processing.core.PGraphics.Java2D cannot be cast to processing.opengl.PGraphicsOpenGL" pointing at line 15 "tex = new GLTexture(app);"

  • @smtababaie did this ever work for you?

  • No , I switched to openframeworks

Sign In or Register to comment.