Advertisement
Guest User

muimota

a guest
Aug 21st, 2009
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1. #ifndef _TEST_APP
  2. #define _TEST_APP
  3.  
  4.  
  5. #include "ofMain.h"
  6.  
  7. class testApp : public ofBaseApp{
  8.  
  9.     public:
  10.  
  11.         testApp();
  12.         void setup();
  13.         void update();
  14.         void draw();
  15.  
  16.         void keyPressed  (int key);
  17.         void keyReleased(int key);
  18.         void mouseMoved(int x, int y );
  19.         void mouseDragged(int x, int y, int button);
  20.         void mousePressed(int x, int y, int button);
  21.         void mouseReleased(int x, int y, int button);
  22.         void resized(int w, int h);
  23.  
  24.         ofGstUtils          gstPipe;
  25.         ofImage             pipeImg;
  26. };
  27.  
  28. #endif
  29.  
  30.  
  31. //testApp.cpp
  32. #include "testApp.h"
  33. #include "stdio.h"
  34.  
  35. //--------------------------------------------------------------
  36. testApp::testApp(){
  37.  
  38. }
  39.  
  40. //--------------------------------------------------------------
  41. void testApp::setup(){
  42.     ofBackground(255,255,255);
  43.     gstPipe.setPipeline("videotestsrc ! video/x-raw-rgb, bpp=24, width=320, height=240 ");
  44.     gstPipe.play();
  45.     pipeImg.allocate(gstPipe.getWidth(),gstPipe.getHeight(),OF_IMAGE_COLOR);
  46. }
  47.  
  48. //--------------------------------------------------------------
  49. void testApp::update(){
  50.     gstPipe.update();
  51.     pipeImg.setFromPixels(gstPipe.getPixels(),gstPipe.getWidth(),gstPipe.getHeight(),OF_IMAGE_COLOR,true);
  52. }
  53.  
  54. //--------------------------------------------------------------
  55. void testApp::draw(){
  56.     ofSetColor(0xFFFFFF);
  57.     pipeImg.draw(0,0);
  58.     ofSetColor(0x000000);
  59. }
  60.  
  61. //--------------------------------------------------------------
  62. void testApp::keyPressed  (int key){
  63.     switch(key){
  64.  
  65.     }
  66. }
  67.  
  68. //--------------------------------------------------------------
  69. void testApp::keyReleased(int key){
  70.  
  71. }
  72.  
  73. //--------------------------------------------------------------
  74. void testApp::mouseMoved(int x, int y ){
  75.  
  76. }
  77.  
  78. //--------------------------------------------------------------
  79. void testApp::mouseDragged(int x, int y, int button){
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement