//---------------------------------------------------------- void ofTexture::loadData(const ofShortPixels & pix, int glFormat){ if(!isAllocated()){ allocate(pix.getWidth(), pix.getHeight(), ofGetGlInternalFormat(pix), ofGetUsingArbTex(), glFormat, ofGetGlType(pix)); } ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getWidth(),pix.getBytesPerChannel(),ofGetNumChannelsFromGLFormat(glFormat)); loadData(pix.getData(), pix.getWidth(), pix.getHeight(), glFormat, ofGetGlType(pix)); }
//---------------------------------------------------------- void ofTexture::allocate(const ofShortPixels& pix, bool bUseARBExtention){ allocate(pix.getWidth(), pix.getHeight(), ofGetGlInternalFormat(pix), bUseARBExtention, ofGetGlFormat(pix), ofGetGlType(pix)); if((pix.getPixelFormat()==OF_PIXELS_GRAY || pix.getPixelFormat()==OF_PIXELS_GRAY_ALPHA) && ofIsGLProgrammableRenderer()){ setRGToRGBASwizzles(true); } loadData(pix); }
//---------------------------------------------------------- void ofTexture::loadData(const ofShortPixels & pix){ if(!isAllocated()){ allocate(pix); }else{ ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getBytesStride()); loadData(pix.getData(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix)); } }
//---------------------------------------------------------- void ofTexture::readToPixels(ofShortPixels & pixels) const { #ifndef TARGET_OPENGLES pixels.allocate(texData.width,texData.height,ofGetImageTypeFromGLType(texData.glInternalFormat)); ofSetPixelStoreiAlignment(GL_PACK_ALIGNMENT,pixels.getWidth(),pixels.getBytesPerChannel(),pixels.getNumChannels()); glBindTexture(texData.textureTarget,texData.textureID); glGetTexImage(texData.textureTarget,0,ofGetGlFormat(pixels),GL_UNSIGNED_SHORT,pixels.getData()); glBindTexture(texData.textureTarget,0); #endif }
ofShortPixels ofApp::cleanDepth(ofShortPixels dirtyDepth, int numPasses) { ofShortPixels cleanedDepth; cleanedDepth.allocate(dirtyDepth.getWidth(), dirtyDepth.getHeight(), dirtyDepth.getImageType()); depth_cleaner_ = new cv::rgbd::DepthCleaner(toCv(dirtyDepth).depth(), windowSize, cv::rgbd::DepthCleaner::DEPTH_CLEANER_NIL); depth_cleaner_->operator()(toCv(dirtyDepth), toCv(cleanedDepth)); for(int i = 0; i < numPasses - 1; i++) { depth_cleaner_->operator()(toCv(cleanedDepth), toCv(cleanedDepth)); } return cleanedDepth; }
void ofxTexture3d::loadData(ofShortPixels & pix, int d, int xOffset, int yOffset, int zOffset) { loadData(pix.getData(), pix.getWidth(), pix.getHeight(), d, xOffset, yOffset, zOffset, ofGetGlFormat(pix)); }
//---------------------------------------------------------- void ofTexture::loadData(const ofShortPixels & pix, int glFormat){ ofSetPixelStorei(pix.getWidth(),pix.getBytesPerChannel(),ofGetNumChannelsFromGLFormat(glFormat)); loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), glFormat, ofGetGlType(pix)); }
//---------------------------------------------------------- void ofTexture::loadData(const ofShortPixels & pix){ ofSetPixelStorei(pix.getBytesStride()); loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix)); }
//---------------------------------------------------------- void ofTexture::allocate(const ofShortPixels& pix, bool bUseARBExtention){ allocate(pix.getWidth(), pix.getHeight(), ofGetGlInternalFormat(pix), bUseARBExtention, ofGetGlFormat(pix), ofGetGlType(pix)); }
//---------------------------------------------------------- void ofTexture::allocate(const ofShortPixels& pix){ allocate(pix.getWidth(), pix.getHeight(), ofGetGlInternalFormat(pix), ofGetUsingArbTex(), ofGetGlFormat(pix), ofGetGlType(pix)); }
//---------------------------------------------------------- void ofTexture::loadData(const ofShortPixels & pix){ loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix)); }
//---------------------------------------------------------- void ofTexture::loadData(const ofShortPixels & pix, int glFormat){ ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getWidth(),pix.getBytesPerChannel(),ofGetNumChannelsFromGLFormat(glFormat)); loadData(pix.getData(), pix.getWidth(), pix.getHeight(), glFormat, ofGetGlType(pix)); }