#105 bug in glGetTexImage()

v2.0.1
closed-fixed
GL (74)
7
2004-10-18
2004-04-27
Anonymous
No

glGetTexImage() fails when using non-square textures.
It returns height x height texture instead of texture with correct dimensions. I suppose the bug is in get_tex_dims(), the GL_TEXTURE_HEIGHT in case GL_TEXTURE_1D should probably be GL_TEXTURE_WIDTH.

int get_tex_dims(GLenum target, GLint level, int dims[4])
{
int rank = 0;

/* just cascade through the switch, retrieving the apropriate sizes */
switch (target)
{
case GL_TEXTURE_4D_SGIS:
glGetTexLevelParameteriv(target, level, GL_TEXTURE_4DSIZE_SGIS, dims + rank++);
case GL_TEXTURE_3D:
glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, dims + rank++);
case GL_TEXTURE_2D:
glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, dims + rank++);
case GL_TEXTURE_1D:
glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, dims + rank++);
}

return rank;
}

Discussion

  • Logged In: YES
    user_id=34901

    Okay, fixed this and another bug that showed up later in the
    function regarding the number of dimensions in the resulting
    array. There's also now a test/demo in OpenGLContext for
    both the array and string forms.

     
    • priority: 5 --> 7
    • assigned_to: nobody --> mcfletch
    • status: open --> closed-fixed