Permalink
Browse files

updated image

  • Loading branch information...
daitomanabe committed Jan 13, 2011
1 parent 1c2b35f commit 43ae91306f7cf47f68f99547f9ba11f7da0c3b82
Showing with 10 additions and 2 deletions.
  1. +7 −2 src/ofxImageGenerator.cpp
  2. +3 −0 src/ofxImageGenerator.h
@@ -3,15 +3,20 @@
void ofxImageGenerator::generateTexture(){
xn::ImageMetaData imd;
image_generator.GetMetaData(imd);
+ const XnUInt8* pImage = imd.Data();
+ memcpy(image_pixels, pImage, sizeof(unsigned char) * imd.XRes() * imd.YRes() * 3);
+ image_texture.loadData(image_pixels,imd.XRes(), imd.YRes(), GL_RGB);
}
void ofxImageGenerator::draw(float x, float y, float w, float h){
-
+ generateTexture();
+ glColor3f(1,1,1);
+ image_texture.draw(x, y, w, h);
}
bool ofxImageGenerator::setup(ofxOpenNIContext* pContext) {
- //Create depth generator
+ //Create image generator
XnStatus result = image_generator.Create(pContext->getXnContext());
if (result != XN_STATUS_OK){
View
@@ -7,8 +7,11 @@ class ofxImageGenerator {
ofxImageGenerator(){}
bool setup(ofxOpenNIContext* pContext);
+
void generateTexture();
+
void draw(float x=0, float y=0, float w=640, float h=480);
+
xn::ImageGenerator& getXnImageGenerator();
private:

0 comments on commit 43ae913

Please sign in to comment.