本文整理汇总了C++中ofFloatPixels类的典型用法代码示例。如果您正苦于以下问题:C++ ofFloatPixels类的具体用法?C++ ofFloatPixels怎么用?C++ ofFloatPixels使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofFloatPixels类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allocate
//----------------------------------------------------------
void ofTexture::allocate(const ofFloatPixels& 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);
}
示例2: ofGetGlInternalFormat
//---------------------------------
int ofGetGlInternalFormat(const ofFloatPixels& pix) {
#ifndef TARGET_OPENGLES
switch(pix.getNumChannels()) {
case 3: return GL_RGB32F;
case 4: return GL_RGBA32F;
case 2:
if(ofIsGLProgrammableRenderer()){
return GL_RG32F;
}else{
return GL_LUMINANCE_ALPHA32F_ARB;
}
default:
if(ofIsGLProgrammableRenderer()){
return GL_R32F;
}else{
return GL_LUMINANCE32F_ARB;
}
}
#else
ofLogWarning("ofGLUtils") << "ofGetGlInternalFormat(): float textures 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
}
示例3: readToPixels
//----------------------------------------------------------
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
}
示例4: loadData
//----------------------------------------------------------
void ofTexture::loadData(const ofFloatPixels & pix){
if(!isAllocated()){
allocate(pix);
}else{
ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getBytesStride());
loadData(pix.getData(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix), ofGetGlType(pix));
}
}
示例5: readToPixels
void ofTexture::readToPixels(ofFloatPixels & 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_FLOAT,pixels.getData());
glBindTexture(texData.textureTarget,0);
#endif
}
示例6: getFreeImageType
FREE_IMAGE_TYPE getFreeImageType(ofFloatPixels& pix) {
switch(pix.getNumChannels()) {
case 1: return FIT_FLOAT;
case 3: return FIT_RGBF;
case 4: return FIT_RGBAF;
default:
ofLogError() << "Unkown freeimage type for" << pix.getNumChannels() << "channels";
return FIT_UNKNOWN;
}
}
示例7: readToPixels
//----------------------------------------------------------
void ofFbo::readToPixels(ofFloatPixels & 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_FLOAT, pixels.getData());
unbind();
#endif
}
示例8: ofGetGlInternalFormat
//---------------------------------
int ofGetGlInternalFormat(const ofFloatPixels& pix) {
#ifndef TARGET_OPENGLES
switch(pix.getNumChannels()) {
case 3: return GL_RGB32F_ARB;
case 4: return GL_RGBA32F_ARB;
default: return GL_LUMINANCE32F_ARB;
}
#else
ofLogWarning()<< "float textures not supported in GLES";
switch(pix.getNumChannels()) {
case 3: return GL_RGB;
case 4: return GL_RGBA;
default: return GL_LUMINANCE;
}
#endif
}
示例9: getFreeImageType
FREE_IMAGE_TYPE getFreeImageType(const ofFloatPixels& pix) {
switch(pix.getNumChannels()) {
case 1: return FIT_FLOAT;
case 3: return FIT_RGBF;
case 4: return FIT_RGBAF;
default:
ofLogError("ofImage") << "getFreeImageType(): unknown FreeImage type for number of channels:" << pix.getNumChannels();
return FIT_UNKNOWN;
}
}
示例10: switch
// get float pixels from a fbo or texture
void ftUtil::toPixels(ofTexture& _tex, ofFloatPixels& _pixels) {
ofTextureData& texData = _tex.getTextureData();
int format = texData.glInternalFormat;
int readFormat, numChannels;
switch(format){
case GL_R32F: readFormat = GL_RED, numChannels = 1; break; // or is it GL_R
case GL_RG32F: readFormat = GL_RG, numChannels = 2; break;
case GL_RGB32F: readFormat = GL_RGB, numChannels = 3; break;
case GL_RGBA32F: readFormat = GL_RGBA, numChannels = 4; break;
default:
ofLogWarning("ftUtil") << "toPixels: " << "can only read float textures to ofFloatPixels";
return;
}
if (_pixels.getWidth() != texData.width || _pixels.getHeight() != texData.height || _pixels.getNumChannels() != numChannels) {
_pixels.allocate(texData.width, texData.height, numChannels);
}
ofSetPixelStoreiAlignment(GL_PACK_ALIGNMENT, texData.width, 4, numChannels);
glBindTexture(texData.textureTarget, texData.textureID);
glGetTexImage(texData.textureTarget, 0, readFormat, GL_FLOAT, _pixels.getData());
glBindTexture(texData.textureTarget, 0);
}
示例11: loadData
//----------------------------------------------------------
void ofTexture::loadData(const ofFloatPixels & pix){
loadData(pix.getPixels(), pix.getWidth(), pix.getHeight(), ofGetGlFormat(pix));
}
示例12: allocate
//----------------------------------------------------------
void ofTexture::allocate(const ofFloatPixels& pix){
allocate(pix.getWidth(), pix.getHeight(), ofGetGlInternalFormat(pix), ofGetUsingArbTex(), ofGetGlFormat(pix), ofGetGlType(pix));
}
示例13: loadData
//----------------------------------------------------------
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));
}
示例14: loadData
void ofxTexture3d::loadData(ofFloatPixels & pix, int d, int xOffset, int yOffset, int zOffset)
{
loadData(pix.getData(), pix.getWidth(), pix.getHeight(), d, xOffset, yOffset, zOffset, ofGetGlFormat(pix));
}
示例15: loadData
//----------------------------------------------------------
void ofTexture::loadData(const ofFloatPixels & pix, int glFormat){
ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getWidth(),pix.getBytesPerChannel(),ofGetNumChannelsFromGLFormat(glFormat));
loadData(pix.getData(), pix.getWidth(), pix.getHeight(), glFormat, ofGetGlType(pix));
}