Larges FBOs


I have quite the same problem than HanWu several days ago: I need to make a “printable” version of my scene, with a resolution around 300dpi, which means that I need a large view (3444x2400 for instance). That is quite larger than my window, I need an offscreen rendering solution => I use a FBO.

The glTexImage does not produce any error (GL_MAX_TEXTURE returns 4096, so it is ok) but the glCheckFramebufferStatusEXT does not return GL_FRAMEBUFFER_COMPLETE_EXT at the end.

If the resolution is lower, the FBO has no problem.

Do you know this problem and is there another solution than tiling?

I don’t really remember, check the specs on this site for more information. Did you also checked GL_MAX_RENDERBUFFER_SIZE_EXT ?

glGetIntegerv with GL_MAX_RENDERBUFFER_SIZE_EXT returns 4096.
Moreover, the glRenderbufferStorageEXT returns no GL error.
This is my source code (m_gl_target can be GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE):

void GLWidget::update_tex (void)
    if (!m_fbo_init)
	int value;
	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
	qDebug("GL_MAX_TEXTURE_SIZE = %d", value); // GL_MAX_TEXTURE_SIZE = 4096
	glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &value);

	// Creating objects
	glGenTextures (1, &m_fbo_color_buffer);
	glGenRenderbuffersEXT (1, &m_fbo_depth_buffer);
	glGenFramebuffersEXT (1, &m_fbo_frame_buffer);

    // Binding objects
    glBindTexture (m_gl_target, m_fbo_color_buffer);
    glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, m_fbo_depth_buffer);
    glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, m_fbo_frame_buffer);

    if (!m_fbo_init)
	// +------------------------------------+
	// |                                    |
	// |       There is the problem:        |
	// |          1024x1024 is ok           |
	// | 2048x2048 fails on the next assert |
	// |                                    |
	// +------------------------------------+

	// Initialization of the texture
	glTexParameteri (m_gl_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri (m_gl_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameteri (m_gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri (m_gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP);
	glTexImage2D (m_gl_target, 0, GL_RGBA, m_fbo_wtex, m_fbo_htex, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );

	// Initialize the Depth Render Buffer
	glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, m_fbo_wtex, m_fbo_htex);

	// Attach texture to FrameBuffer
	glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, m_gl_target, m_fbo_color_buffer, 0);

	// Attach the Render Buffer to the Frame Buffer
	glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_fbo_depth_buffer);

	// Checking the status
	// +------------------------+
	// | this is where it fails |
	// +------------------------+

    // Drawing
    // ...

    // Unbinding
    glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, 0);
    glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
    glBindTexture (m_gl_target, 0);

So you say it works well with a resolution of 1024 but not 2048. It looks strange. Try to see what is the real error returned by CheckFramebufferStatus. It might help. Also try to check if the renderbuffer is really a renderbuffer (glIsRenderBufferEXT).

I don’t see any bad things in your code.

What is your graphic card ? What driver ?

I’m using 2048x1024 on GeForce 6, GeForce 7 and Radeon X. Works fine with RGBA8 and RGB16F (on GeForce).

Try placing
glBindTexture (m_gl_target, 0);
just after

This is from specs:

Special precautions need to be taken to avoid attaching a texture image to the currently bound framebuffer while the texture object is currently bound and enabled for texturing.
It’s obvious that you can’t use a texture in rendering if it’s current render target. But it should be ok during framebuffer creation. Perhaps driver gets confused.

IsRenderbuffer returns GL_TRUE.
CheckFramebufferStatus returns FRAMEBUFFER_UNSUPPORTED_EXT
I made a lot of glGetError and it always returns GL_NO_ERROR.
I have a NV QuadroFX 540 with 9629 drivers (under linux).

With 2048x1024 it works fine. I tried many resolutions to find the limit. I obtained the following: 2048x1635 always works, 2048x1636 always fails.
Unbinding the texture didn’t change anything.

To my point of view you whether are under the limits of your graphic card or whether you are under a ‘bug’ in the driver.

Read the nvidia readme file providen with the driver. It might help. AFAIK there had issues with such cards.

I have a geforce fx with 8774 drivers under linux and this works well.

So maybe you can try to report it to nvidia directly.

I can confirm similar behaviour, i.e. limited resolutions before FRAMEBUFFER_UNSUPPORTED_EXT, on nVidia Quadro FX 550, ForceWare 162.65, Win XP.

Quite annoying…