Why is glFramebufferTexture a NULL pointer when GLEW_ARB_framebuffer_object is non-zero?

StackOverflow https://stackoverflow.com/questions/23550052

  •  18-07-2023
  •  | 
  •  

Question

My code looks roughly like this:

GLenum glewStatus = glewInit();
if (glewStatus != GLEW_OK)
    exit(1);

if (!GLEW_ARB_framebuffer_object)
    exit(1);

printf("%p\n", glFramebufferTexture);

This prints 0, so that explains why calling glFramebufferTexture() immediately segfaults.

However, why is it 0? A lot of the other framebuffer functions are working just fine (e.g. glBindFramebuffer, glFramebufferRenderbuffer, and glBindFramebuffer).

Do I need to initialise GLEW or the extension differently?

Was it helpful?

Solution

glFramebufferTexture() is a newer entry point than glBindFramebuffer() and other FBO related entry points. In the core OpenGL spec, glFramebufferTexture() was added in 3.2, while the rest of the FBO functionality was part of 3.0. glFramebufferTexture() was also not part of ARB_framebuffer_object.

You can use glFramebufferTexture2D() in most cases, which is part of the original FBO functionality. glFramebufferTexture() is only different for things like texture arrays, cube maps, etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top