OpenGL Framebuffer size limit is 0

437 views Asked by At

I use OpenGL FrameBuffer Objects (FBO) to render to textures using either GL_ARB_FRAMEBUFFER_OBJECT or GL_EXT_FRAMEBUFFER_OBJECT extentions.

However, there are significant number of videocards (mostly Intel, with OGL 2.0 and even 3.0) supporting GL_ARB_FRAMEBUFFER_OBJECT but having GL_MAX_FRAMEBUFFER_WIDTH=0 and GL_MAX_FRAMEBUFFER_HEIGHT=0, so it fails when I try to attach a texture to FBO.

Does it really mean that FBO can't be used for rendering to textures on these videocards? Is there a workaround? Render to texture is a very important rendering technique, and it works well with Direct3D everywhere, so there should be a way to use it using OpenGL too.

1

There are 1 answers

0
derhass On BEST ANSWER

However, there are significant number of videocards (mostly Intel, with OGL 2.0 and even 3.0) supporting GL_ARB_FRAMEBUFFER_OBJECT but having GL_MAX_FRAMEBUFFER_WIDTH=0 and GL_MAX_FRAMEBUFFER_HEIGHT=0, so it fails when I try to attach a texture to FBO.

Neither GL_ARB_framebuffer_object nor GL_EXT_framebuffer_object do define GL_MAX_FRAMEBUFFER_WIDTH or GL_MAX_FRAMEBUFFER_HEIGHT.

These enums were actually added in GL_ARB_framebuffer_no_attachments (core since OpenGL 4.3), so it is no wonder that some Intel GPUs don't support these. (If you'd check for errors, you would have noticed some GL_INVALID_ENUM from your glGets - so it is not returning zero, it is erroring out on the get, leaving the contents of your variable as it was before). However, the main point is that these limits are only relevant for a framebuffer without any attachment, so you are querying the wrong property here.

There is no explicit size limit for the framebuffer, but there are size limits for each attachment type. Renderbuffers can be at most GL_MAX_RENDERBUFFER_SIZE in any dimension, and 2D tetxures at most GL_TEXTURE_SIZE. If you want to render to the target in a single pass, you might also want to care about the GL_MAX_VIEWPORT_DIMS.