Results 1 to 6 of 6

Thread: How does OpenGL store its textures

  1. #1
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    How does OpenGL store its textures

    Simple question.

    Can i assume, that OpenGL _always_ holds a seperate copy of a texture in system-memory, no matter if it fits into VRAM or not?

    I figured out that my very simple engine eats 42 MB of system-memory and i discovered, that when i donīt load one 3 MB texture, it uses 4 or 5 MB less (the extra 1 or 2 MB are certainly the mipmaps).

    Thanks,
    Jan.
    GLIM - Immediate Mode Emulation for GL3

  2. #2
    Senior Member Regular Contributor
    Join Date
    Sep 2001
    Location
    Eastern USA
    Posts
    218

    Re: How does OpenGL store its textures

    I don't think that's a safe assumption. Are you freeing the memory in which you store the textures prior to uploading them?

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jun 2003
    Posts
    177

    Re: How does OpenGL store its textures

    OpenGL always holds a copy of the texture *somewhere*. The driver decides if that "somewhere" is on the video card, in AGP memory, or in system memory, or if multiple copies are needed (or not).

    Once you hand GL a texture, you don't need to keep the source data around anymore.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2001
    Location
    Italy
    Posts
    625

    Re: How does OpenGL store its textures

    I can confirm that. Keeping textures is an old-fashioned thing which is slow to die.
    Delete[] you texture arrays passed to TexImage immedialty after calling that function.

    As a side note, this is why most games reload everything after you changed resolution (window destroyed -> gl destroyed -> textures lost -> need to reload). If they keep the textures in application space ram, they would not need it.
    EDIT: whoops, wrong function

    [This message has been edited by Obli (edited 08-01-2003).]

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: How does OpenGL store its textures

    I do delete my textures after loading them (i checked it, there is no error in my loading code).
    But still it seems as if OpenGL keeps a seperate copy for every texture in system-memory.
    But maybe it does that only with big textures (3MB and up) to be able to swap a single texture out and freeing a lot of space.
    My gfx card has 128 MB RAM and i use maybe 10 MB, therefore this is not necessary, but of course the driver doesnīt know that.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    595

    Re: How does OpenGL store its textures

    WEll, what if you start 40 other opengl programs, then i probably NEEDS the texture to be uploaded again, so yes it keeps a copy, but as stated before, you cannot say where it is.. In windows i think its safe to assume its in the system Ram.

Similar Threads

  1. Want to store textures, access them later
    By Matt Phillips in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-02-2010, 01:44 PM
  2. Extract and store opengl data?
    By HHHHG in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-10-2010, 05:45 AM
  3. store a lot of textures for later use
    By LR123 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-13-2009, 11:29 AM
  4. Does the graphics card store textures as floats or short ints?
    By Keermalec in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-25-2003, 01:01 PM
  5. How does OpenGL store it's states?
    By WhatEver in forum OpenGL: Advanced Coding
    Replies: 42
    Last Post: 04-18-2001, 01:22 AM

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