//---------------------------------------------------------- void ofTexture::readToPixels(ofFloatPixels & pixels){ #ifndef TARGET_OPENGLES pixels.allocate(texData.width,texData.height,ofGetImageTypeFromGLType(texData.glTypeInternal)); bind(); glGetTexImage(texData.textureTarget,0,ofGetGlFormat(pixels),GL_FLOAT,pixels.getPixels()); unbind(); #endif }
void ofFbo::readToPixels(ofFloatPixels & 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_FLOAT, pixels.getPixels()); unbind(); #endif }
void ofFbo::readToPixels(ofFloatPixels & pixels, int attachmentPoint){ if(!bIsAllocated) return; #ifndef TARGET_OPENGLES getTextureReference(attachmentPoint).readToPixels(pixels); #else pixels.allocate(settings.width,settings.height,ofGetImageTypeFromGLType(settings.internalformat)); bind(); int format = ofGetGLFormatFromInternal(settings.internalformat); glReadPixels(0,0,settings.width, settings.height, format, GL_FLOAT, pixels.getPixels()); unbind(); #endif }
//---------------------------------------------------------- void ofTexture::loadData(const ofFloatPixels & pix, int glFormat){ ofSetPixelStorei(pix.getWidth(),pix.getBytesPerChannel(),ofGetNumChannelsFromGLFormat(glFormat)); loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), glFormat, ofGetGlType(pix)); }
//---------------------------------------------------------- void ofTexture::loadData(const ofFloatPixels & pix){ ofSetPixelStorei(pix.getBytesStride()); loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix)); }
//---------------------------------------------------------- void ofTexture::loadData(const ofFloatPixels & pix){ loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix)); }