glGetTexLevelParameteriv in ilutGLSubTex

2006-12-28
2013-05-02
  • The usage of glGetTexLevelParameteriv stalls the OpenGL pipeline.
    Can I suggest to execute this piece of code in ilutGLSubTex only in the debug builds?

    ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff)
    {
        ILimage    *Image;
    #ifdef IL_DEBUG
        ILint Width, Height;
    #endif
    ...
        glBindTexture(GL_TEXTURE_2D, TexID);

    #ifdef IL_DEBUG
        glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH,  (GLint*)&Width);
        glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, (GLint*)&Height);

        if (Image->Width + XOff > (ILuint)Width || Image->Height + YOff > (ILuint)Height) {
            ilSetError(ILUT_BAD_DIMENSIONS);
            return IL_FALSE;
        }
    #endif

    ....

     
    • Dario Meloni
      Dario Meloni
      2006-12-29

      I think it's better leave the tests.
      XOff and YOff are user provided values, they may be wrong values.