Results 1 to 4 of 4

Thread: [Q] When I call glDeleteTexture function..

  1. #1
    Member Contributor
    Join Date
    Apr 2010
    Posts
    53

    [Q] When I call glDeleteTexture function..

    hello .

    I put texture image data in heap memory..

    If I call glDeleteTexture function, is that memory cleared and released automatically ??

    if not, I think there'll be some memory leakage..

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    442

    Re: [Q] When I call glDeleteTexture function..

    When you bind your texture, OpenGL will place a *copy* of that texture into an appropriate place (either system memory or texture memory). In theory you can allocate heap, load your texture, bind your texture and then release the heap memory and still use that texture via. its bind Id.

    In other words, you are responsible for deleting memory YOU have allocated. OpenGL will deal with the memory it allocates (behind the scenes) when you bind your texture.

    Hope this helps.

  3. #3
    Member Contributor
    Join Date
    Apr 2010
    Posts
    53

    Re: [Q] When I call glDeleteTexture function..

    First of all , thanks for your help .

    So, even though I deleted the memory on the heap allocated to my texture data after loading texture data, there exists some momory block containing RGB data somewhere and still, I can use that data via ID.

    Right ?

    Here, I have a question..

    If I don't call glDeleteTexture function when my program is about end, is there any memory leakage ?? or.... is it automatically released ??

  4. #4
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    442

    Re: [Q] When I call glDeleteTexture function..

    Yes, thats basically correct. Once you have bound the texture, GL will take over management *of its copy*, you are then free to release the memory you used to load it.

    When you call glDelete*, the driver will free its copy internally. Its best practice to delete textures yourself using glDelete* and most if not all drivers will release the texture memory assigned to your textures internally when you delete the gl render context.

Similar Threads

  1. how can I call the function wglSwapIntervalEXT
    By GermanGuy in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-01-2014, 12:06 AM
  2. Is the following function call valid?
    By Lvl80retpaladin in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-08-2010, 05:14 PM
  3. call back function for stdin
    By hakko in forum OpenGL: Linux
    Replies: 2
    Last Post: 11-07-2001, 02:29 AM
  4. Call back function for 'stdin'
    By hakko in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-05-2001, 07:44 AM
  5. what is call back function
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-19-2000, 05:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean