Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _TEST_APP
- #define _TEST_APP
- #include "ofMain.h"
- class testApp : public ofBaseApp{
- public:
- testApp();
- void setup();
- void update();
- void draw();
- void keyPressed (int key);
- void keyReleased(int key);
- void mouseMoved(int x, int y );
- void mouseDragged(int x, int y, int button);
- void mousePressed(int x, int y, int button);
- void mouseReleased(int x, int y, int button);
- void resized(int w, int h);
- ofGstUtils gstPipe;
- ofImage pipeImg;
- };
- #endif
- //testApp.cpp
- #include "testApp.h"
- #include "stdio.h"
- //--------------------------------------------------------------
- testApp::testApp(){
- }
- //--------------------------------------------------------------
- void testApp::setup(){
- ofBackground(255,255,255);
- gstPipe.setPipeline("videotestsrc ! video/x-raw-rgb, bpp=24, width=320, height=240 ");
- gstPipe.play();
- pipeImg.allocate(gstPipe.getWidth(),gstPipe.getHeight(),OF_IMAGE_COLOR);
- }
- //--------------------------------------------------------------
- void testApp::update(){
- gstPipe.update();
- pipeImg.setFromPixels(gstPipe.getPixels(),gstPipe.getWidth(),gstPipe.getHeight(),OF_IMAGE_COLOR,true);
- }
- //--------------------------------------------------------------
- void testApp::draw(){
- ofSetColor(0xFFFFFF);
- pipeImg.draw(0,0);
- ofSetColor(0x000000);
- }
- //--------------------------------------------------------------
- void testApp::keyPressed (int key){
- switch(key){
- }
- }
- //--------------------------------------------------------------
- void testApp::keyReleased(int key){
- }
- //--------------------------------------------------------------
- void testApp::mouseMoved(int x, int y ){
- }
- //--------------------------------------------------------------
- void testApp::mouseDragged(int x, int y, int button){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement