Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: glTexImage2DMultisample with GL_DEPTH_COMPONENT results in GL_INVALID_VALUE

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    16

    glTexImage2DMultisample with GL_DEPTH_COMPONENT results in GL_INVALID_VALUE

    I don't know if this is a driver problem or my fault:

    Code :
    NSLog(@"GL_MAX_TEXTURE_SIZE: %d  (%d, %d)", GL_MAX_TEXTURE_SIZE, width, height);
    NSLog(@"GL_MAX_SAMPLES: %d", GL_MAX_SAMPLES);
    glGenTextures(1, &shadowTextureId);
    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, shadowTextureId);
    glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_DEPTH_COMPONENT , width, height, false);
    [YALog isGLStateOk:TAG];

    The output is:

    Code :
    GL_MAX_TEXTURE_SIZE: 3379  (512, 512)
    GL_MAX_SAMPLES: 36183
    [YAShadowMap] glTexImage2DMultisample  [OpenGL] GL_INVALID_VALUE


    GL_INVALID_VALUE is called if:

    GL_INVALID_VALUE is generated if either width or height negative or is greater than GL_MAX_TEXTURE_SIZE.
    GL_INVALID_VALUE is generated if samples is greater than GL_MAX_SAMPLES.

    Both causes can be excluded.

    My
    NSOpenGLPixelFormatAttribute looks like this:

    Code :
            NSOpenGLPFAMultisample  ,
            NSOpenGLPFASampleBuffers, 1,
            NSOpenGLPFASamples, 4,

    and multisample is enabled:
    Code :
    glEnable(GL_MULTISAMPLE);




  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    783
    Quote Originally Posted by yousry View Post
    Code :
    NSLog(@"GL_MAX_SAMPLES: %d", GL_MAX_SAMPLES);

    That isn't how queries work.
    You use GL_MAX_ enums to ask the driver what the limit is, like this:
    Code :
    GLint max_samples = 0;
    glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
    NSLog(@"GL_MAX_SAMPLES: %d", max_samples);


    And, because you're using a depth format, the specification says the actual limit is MAX_DEPTH_TEXTURE_SAMPLES, not MAX_SAMPLES. And I'm guessing you're using an ATI GPU, where you can see that the limit is "1".

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2011
    Posts
    16
    Thank You.
    I confused a query with an extension availability check.
    Also GL_MAX_TEXTURE_SIZE(16384) doesn't help, because glFramebufferTexture2D then creates a GL_FRMAEBUFFER_UNSUPPORTED error.
    Last edited by yousry; 02-04-2013 at 01:53 PM. Reason: removed hidden html tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •