本文整理汇总了C++中ofShortPixels::allocate方法的典型用法代码示例。如果您正苦于以下问题:C++ ofShortPixels::allocate方法的具体用法?C++ ofShortPixels::allocate怎么用?C++ ofShortPixels::allocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofShortPixels
的用法示例。
在下文中一共展示了ofShortPixels::allocate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readToPixels
//----------------------------------------------------------
void ofTexture::readToPixels(ofShortPixels & pixels){
#ifndef TARGET_OPENGLES
pixels.allocate(texData.width,texData.height,ofGetImageTypeFromGLType(texData.glTypeInternal));
bind();
glGetTexImage(texData.textureTarget,0,ofGetGlFormat(pixels),GL_UNSIGNED_SHORT,pixels.getPixels());
unbind();
#endif
}
示例2: readToPixels
//----------------------------------------------------------
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
}
示例3: readToPixels
//----------------------------------------------------------
void ofFbo::readToPixels(ofShortPixels & pixels, int attachmentPoint) const{
if(!bIsAllocated) return;
#ifndef TARGET_OPENGLES
getTexture(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_UNSIGNED_SHORT, pixels.getData());
unbind();
#endif
}
示例4: readCompressedPng
void ofxDepthImageCompressor::readCompressedPng(string filename, ofShortPixels& pix){
if(!pix.isAllocated()){
pix.allocate(640, 480, 1);
}
readCompressedPng(filename, pix.getPixels());
}