本文整理汇总了C++中ofShortPixels::getNumChannels方法的典型用法代码示例。如果您正苦于以下问题:C++ ofShortPixels::getNumChannels方法的具体用法?C++ ofShortPixels::getNumChannels怎么用?C++ ofShortPixels::getNumChannels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofShortPixels
的用法示例。
在下文中一共展示了ofShortPixels::getNumChannels方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ofGetGlInternalFormat
//---------------------------------
int ofGetGlInternalFormat(const ofShortPixels& pix) {
#ifndef TARGET_OPENGLES
switch(pix.getNumChannels()) {
case 3: return GL_RGB16;
case 4: return GL_RGBA16;
case 2:
if(ofIsGLProgrammableRenderer()){
return GL_RG16;
}else{
return GL_LUMINANCE16_ALPHA16;
}
default:
if(ofIsGLProgrammableRenderer()){
return GL_R16;
}else{
return GL_LUMINANCE16;
}
}
#else
ofLogWarning("ofGLUtils") << "ofGetGlInternalFormat(): 16bit textures are not supported in OpenGL ES";
switch(pix.getNumChannels()) {
case 3: return GL_RGB;
case 4: return GL_RGBA;
case 2:
return GL_LUMINANCE_ALPHA;
default:
return GL_LUMINANCE;
}
#endif
}
示例2: getFreeImageType
FREE_IMAGE_TYPE getFreeImageType(ofShortPixels& pix) {
switch(pix.getNumChannels()) {
case 1: return FIT_UINT16;
case 3: return FIT_RGB16;
case 4: return FIT_RGBA16;
default:
ofLogError() << "Unkown freeimage type for" << pix.getNumChannels() << "channels";
return FIT_UNKNOWN;
}
}
示例3: ofGetGlInternalFormat
//---------------------------------
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
}
示例4: getFreeImageType
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;
}
}
示例5: 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
}
示例6: loadData
//----------------------------------------------------------
void ofTexture::loadData(const ofShortPixels & pix){
ofSetPixelStorei(pix.getWidth(),pix.getBytesPerChannel(),pix.getNumChannels());
loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix));
}