ofFbo causes segfault on Ubuntu linux with Intel GPU

I’m trying this simple ofFbo example on OF 007, the system is Ubuntu Lucid, with an Intel 945 GPU.

  
//--------------------------------------------------------------  
void testApp::setup(){  
    fbo.allocate(500, 500, GL_RGBA);  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
  
    fbo.begin();  
        ofClear(255, 255, 255, 255);  
        ofSetColor(255, 0, 0);  
        ofCircle(mouseX, mouseY, 100);  
    fbo.end();  
  
    ofSetColor(255);  
    fbo.draw(0, 0);  
}  

I got a segfault in i915 dri, and any test using ofFbo leads to same results.

  
#0 0x1bd3c36    _mesa_FramebufferRenderbufferEXT() (/usr/lib/dri/i915_dri.so:??)  
#1 0x80cc56a    ofFbo::createAndAttachRenderbuffer(this=0x85b28e8, internalFormat=34041, attachmentPoint=33306) (../../../openFrameworks/gl/ofFbo.cpp:489)  
#2 0x80cc352    ofFbo::allocate(this=0x85b28e8, _settings=...) (../../../openFrameworks/gl/ofFbo.cpp:388)  
#3 0x80cc269    ofFbo::allocate(this=0x85b28e8, width=500, height=500, internalformat=6408, numSamples=0) (../../../openFrameworks/gl/ofFbo.cpp:363)  
#4 0x80562ec    testApp::setup(this=0x85b28d8) (src/testApp.cpp:5)  
#5 0x8059ca6    ofNotifySetup() (../../../openFrameworks/events/ofEvents.cpp:73)  
#6 0x8056a23    ofAppGlutWindow::runAppViaInfiniteLoop(this=0xbffff2f8, appPtr=0x85b28d8) (../../../openFrameworks/app/ofAppGlutWindow.cpp:317)  
#7 0x80584cc    ofRunApp(OFSA=0x85b28d8) (../../../openFrameworks/app/ofAppRunner.cpp:82)  
#8 0x8055bfc    main() (src/main.cpp:14)  

any idea about what I should try or where the problem could be? has anyone experienced similar problems?

thanks in advance to all

can you try adding ofSetLogLevel(OF_LOG_VERBOSE); to the top of your setup()? ofFbo should tell you something in the console about whether FBOs are supported by your card or not.

I had already checked through glxinfo, anyway, adding ofSetLogLevel(OF_LOG_VERBOSE) I get:

OF: OF_VERBOSE: FBO supported
OF: OF_LOG_NOTICE: ofFbo::checkGLSupport()
maxColorAttachments: 4
maxDrawBuffers: 1
maxSamples: -1

what it puzzles me is that on the same system, OF 062 with the old ofxFbo addon used to work

can you try allocating the fbo without depth and stencil buffer? the function where it’s crashing is related to that, i suspect your card supports fbos but not renderbuffers

yes! it was exactly that the problem.
I changed the code to:

  
void testApp::setup(){  
ofSetLogLevel(OF_LOG_VERBOSE);  
ofFbo::Settings settings;  
settings.width = 600;    
settings.height = 600;    
settings.internalformat = GL_RGBA;    
settings.numSamples = 0;    
settings.useDepth = false;    
settings.useStencil = false;    
  
  
    //fbo.allocate(500, 500, GL_RGBA);  
    fbo.allocate(settings);  
}  

and it seems to work well.

thank you so much Arturo and Kyle!!

we should really add some code that autodetects the availability of depth and stencil fbos, and doesn’t add them if they’re not available… glad this worked!

yes, totally, i added yesterday an option to use a texture as depth buffer instead of a renderbuffer which is very useful if you want to use the depth info later, with shaders for example. I guess that would actually be compatible with older cards