Search code examples
opengltexture2d

incomplete attachment when using direct state access functions


I am trying to replace my old OpenGL functions with its Direct State Access versions.

I replaced

glBindTexture(m_target, m_name);
glTexStorage2D(m_target, 1, m_format, m_width, m_height);
glBindTexture(m_target, 0);

with

glTextureStorage2D(m_name, 1, m_format, m_width, m_height);

but now I get an "incomplete attachment" error with my fbo.

Am I missing something?


Solution

  • Ah, if I want to use direct state access, I also have to replace

    glGenTextures(1, &m_name);
    

    with

    glCreateTextures(m_target, 1, &m_name);
    

    so that m_name will be conntected to m_target from now on.