Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Something funny going on with ilBlit

bpoteat
2009-04-03
2013-05-02
  • bpoteat
    bpoteat
    2009-04-03

    I have to use 1.7.5 as we have some fully QA'd code that can't have a library changed out from under it without complete retesting. Though I have tried with the latest and get the same problem.

    I am creating a texture atlas using ilTexImage with a blank color, then using ilBlit to overlay the texture images on it in their atlased positions. It works usually works flawlessly but if I run my app, which is a MFC app, from the command line and hide the mainframe (as if it were a cmd line app), I get an error in ilBlit. It could be a coincidence that I am only seeing it in cmd line mode.

    It is an exception in the alpha copy, the "Front =" call below.  And it only seems to happen when the source image originally had no alpha value, even though they are converted to have an alpha value (I always convert everything to IL_BGRA).

    switch (Dest->Type)
    {
        case IL_BYTE:
        case IL_UNSIGNED_BYTE:
            Front = Converted[AlphaIdx]/((float)IL_MAX_UNSIGNED_BYTE);
            break;
    ...

    Anyone have any suggestions from looking at the code? Is it possible that, even though I've done the conversion, the memory is not getting updated to have the extra space for the alpha value?

     
    • bpoteat
      bpoteat
      2009-04-03

      And to add more information - the images are always flipped as I always operate with the origin as IL_ORIGIN_LOWER_LEFT.

       
    • bpoteat
      bpoteat
      2009-04-03

      I got past this - there turned out to be a problem on my end - but I still think there might be a couple of problems here that I am just avoiding.

      I think the problem I had would still be an issue - trying to overlay an image with Bpp of 3 over an image with Bpp of 4.

      Also, it's small, but if you use the origin as lower left you still have to specify the offset from top left. Easy to calculate but it should be done in the call.