//--------------------------------- int ofGetGlInternalFormat(const ofShortPixels& pix) { #ifndef TARGET_OPENGLES switch(pix.getNumChannels()) { case 3: return GL_RGB16; case 4: return GL_RGBA16; default: return GL_LUMINANCE16; } #else ofLogWarning()<< "16bit textures not supported in GLES"; switch(pix.getNumChannels()) { case 3: return GL_RGB; case 4: return GL_RGBA; default: return GL_LUMINANCE; } #endif }
//---------------------------------------------------------- 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)); }
FREE_IMAGE_TYPE getFreeImageType(const ofShortPixels& pix) { switch(pix.getNumChannels()) { case 1: return FIT_UINT16; case 3: return FIT_RGB16; case 4: return FIT_RGBA16; default: ofLogError("ofImage") << "getFreeImageType(): unknown FreeImage type for number of channels:" << pix.getNumChannels(); return FIT_UNKNOWN; } }
void ofFbo::readToPixels(ofShortPixels & pixels, int attachmentPoint){ #ifndef TARGET_OPENGLES getTextureReference(attachmentPoint).readToPixels(pixels); #else bind(); int format,type; ofGetGlFormatAndType(settings.internalformat,format,type); glReadPixels(0,0,settings.width, settings.height, format, GL_UNSIGNED_SHORT, pixels.getPixels()); unbind(); #endif }
void ofxDepthImageCompressor::convertTo8BitImage(ofShortPixels& pix, ofImage& image){ convertTo8BitImage(pix.getPixels(), image); }
ofImage ofxDepthImageCompressor::convertTo8BitImage(ofShortPixels& pix, bool createTexture){ return convertTo8BitImage(pix.getPixels(), createTexture); }
void ofxDepthImageCompressor::readCompressedPng(string filename, ofShortPixels& pix){ if(!pix.isAllocated()){ pix.allocate(640, 480, 1); } readCompressedPng(filename, pix.getPixels()); }
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)); }
bool ofxDepthImageRecorder::addImage(ofShortPixels& image){ return addImage(image.getPixels()); }
//---------------------------------------------------------- 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)); }
//---------------------------------------------------------- void ofTexture::loadData(const ofShortPixels & pix){ ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getBytesStride()); loadData(pix.getData(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix)); }