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 9 of 9

Thread: Free AUX_RGBImageRec ressource impossible

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    5

    Free AUX_RGBImageRec ressource impossible

    Hello,
    I have a huge problem with openGL programs.

    Actually when I get create a AUX_RGBImageRec* with a malloc or thanks a function from OpenGL libraries, it is impossible for removing it with a free.

    So I think you can understand that it is a problem for me especially for memory management and I really don't understand why.

    Has somebody an idea to help me with this problem or is there somebody who has already met that?

    Thanks.
    Livevlad

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2011
    Location
    USA
    Posts
    5

    Re: Free AUX_RGBImageRec ressource impossible

    This isn't even an OpenGL question. Allocating and freeing memory is something you learned when you started programming in C/C++. I'd suggest getting rid of that ancient library Glaux and start using something a little more modern like FreeImage, SOIL, or DeVIL, or write your own loader.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    5

    Re: Free AUX_RGBImageRec ressource impossible

    Thank you for your answer but I need to use this structure especially and trust me I know how works allocation memory that's why I have a problem.
    Why desallocation does not work with this glaux structure.
    I tried asking solution to some friends very good in programming I I think I have good programming capacities too. So if I ask help to people of this forum it is because I have already searched a solution everywhere.

    So if everybody has another idea.

    Thank you.

  4. #4
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    5

    Re: Free AUX_RGBImageRec ressource impossible

    I would like be more accurate:

    actually I can't free the structure if I use this function:

    AUX_RGBImageRec* example = auxDIBImageLoad(filename);

    free(example); //doesn't work

    I tried too delete although glaux is a C library instead of free but it doesn't work too.

    Thx.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,792

    Re: Free AUX_RGBImageRec ressource impossible

    I need to use this structure especially
    I'm curious: what circumstances have put you in the position that you need to use GLaux? Because I can't imagine those being good circumstances.

  6. #6
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    393

    Re: Free AUX_RGBImageRec ressource impossible

    Looking at http://nehe.gamedev.net/tutorial/texture_mapping/12038/ , they use:

    Code :
    if (TextureImage[0])                       // If Texture Exists
    {
        if (TextureImage[0]->data)             // If Texture Image Exists
        {
            free(TextureImage[0]->data);       // Free The Texture Image Memory
        }
     
        free(TextureImage[0]);                 // Free The Image Structure
    }
    so do you need to free "example->data" before freeing "example"?

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2012
    Posts
    5

    Re: Free AUX_RGBImageRec ressource impossible

    No very interesting circumstances, I just need to know how to use it perfectly for a project and because I want to know it too^^

    I know that SOIL library is better but glaux is lower level in programmation that's why I prefer it; to get more control if you prefer. But this problem of free will provok memory leak so it is a serious problem if I want to do something very professionnal.

Posting Permissions

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