Faded Images

Pyroka
2009-05-01
2013-05-02
  • Pyroka
    Pyroka
    2009-05-01

    Hey, I'm having a problem with DevIL that's only recently occurred, when I
    load an image using either ilutGLLoadImage or ilLoadImage (both report no
    errors) anything I then render to the screen appears faded (Not at 100%
    alpha) even if I'm just rendering a normal coloured quad (the quad renders
    fine when I don't load the image)

    Does anyone have any clue as to why this may be happening?

    The code I'm using to load the images is:

    <--- Begin code

    ILenum e;
    GLenum g;

    ILuint tempHandle;
    ilGenImages(1, &tempHandle);
    ilBindImage(tempHandle);

    if(!ilLoadImage(filename.c_str()))
    {
    e = ilGetError();
    return;
    }

    m_format = ilGetInteger(IL_IMAGE_FORMAT);
    m_width = ilGetInteger(IL_IMAGE_WIDTH);
    m_height = ilGetInteger(IL_IMAGE_HEIGHT);
    m_bpp = ilGetInteger(IL_IMAGE_BPP);

    glGenTextures(1, &m_id);
    glBindTexture(GL_TEXTURE_2D, m_id);

    while (g = glGetError())
    {
    const unsigned char* err = gluErrorString(g);
    printf("%d", g);
    }

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    glTexImage2D(GL_TEXTURE_2D, 0, m_bpp, m_width, m_height, 0, m_format,
    GL_UNSIGNED_BYTE, ilGetData());

    ilDeleteImage(tempHandle);

    while (g = glGetError())
    {
    const unsigned char* err = gluErrorString(g);
    printf("%d", g);
    }

    <--- end code

    (Neither glGetError or ilGetError report a problem, and I am Initialising
    il, ilu, and ilut (and setting the renderer for ilut)

    I'm using C++, Visual studio 2008 (although the problem is the same on
    Visual Studio 2005) on Windows XP SP3

    Hopefully someone has a clue what's wrong as I'd hate to end up using
    something else

    Thankyou for your time

    Andrew

    (p.s. Sorry for posting in both here and the support requests, I'm unamiliar with sourceforge and only just found this forum, but thought that this was a better place for my post)

     
    • Denton Woods
      Denton Woods
      2009-05-05

      I have no clue what's wrong right now.  I haven't heard of this problem before.  I will try to replicate this behavior, but it may be a couple of weeks, since the end of the school semester is near.