0

I am using glDebugMessageCallback to capture the OpenGL driver messages.

When I enable all message sources and severities, my program triggers this message:

Texture state usage warning: Texture 0 is base level inconsistent. Check texture size.

The message is triggered by a glReadPixels call that tries to read depth values from a FBO framebuffer using a PixelBufferObject (PBO.)

The exact glReadPixels call looks like this:

glBindBuffer( GL_PIXEL_PACK_BUFFER, pboid );
glReadPixels( srcx, srcy, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, 0 );

And the PBO was created as:

glBindBuffer( GL_PIXEL_PACK_BUFFER, pboid );
glBufferData( GL_PIXEL_PACK_BUFFER, DATA_SIZE, 0, GL_STREAM_READ );

What does the message actually mean? What is "base level consistent?" And what does the level refer to?

The FBO that is being read has a COLOR_ATTACHMENT0 and a DEPTH_ATTACHMENT and is complete.

The color texture (800x640 texels) for the FBO was created with:

glTexImage2D
(
    GL_TEXTURE_2D,
    0,
    GL_RGBA,
    w, h,
    0,
    GL_RGBA,
    GL_UNSIGNED_BYTE,
    0
);

The depth texture (800x640 texels) for the FBO was created with:

GLint internal_fmt = GL_DEPTH_COMPONENT24;
glTexImage2D
(
    GL_TEXTURE_2D,      // target
    0,                  // level
    internal_fmt,       // internal format
    w, h,               // width, height
    0,                  // border
    GL_DEPTH_COMPONENT, // format
    GL_UNSIGNED_INT,    // type
    0                   // pixels
);

glCheckFramebufferStatus(GL_FRAMEBUFFER) returns GL_FRAMEBUFFER_COMPLETE.

glGetError() returns no errors.

OS: Ubuntu LTS

GPU: nVidia GTX750Ti

GL Version: Core Profile 3.3

Driver: NVIDIA 390.116

Bram
  • 7,440
  • 3
  • 52
  • 94
  • 1
    Try `glUseProgram(0)` before `glReadPixels`. Does it solve the issue? – Yakov Galka May 08 '19 at 01:57
  • @ybungalobill Thanks for the solution. Unfortunately, adding that did not change the behavior. The debug message is still there. – Bram May 08 '19 at 02:13
  • 1
    It looks like there's nothing wrong with your code. The driver tries to validate something in the state that might not be relevant to the code at hand. Try clearing other states (e.g. unbind textures). Related: https://stackoverflow.com/questions/17316751/texture-state-usage-warning – Yakov Galka May 08 '19 at 02:19

0 Answers0