Results 1 to 5 of 5

Thread: Memory Problem

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    2

    Memory Problem

    I try to texture a cube with a bmp file. I did but I have a problem about memory. Memory usage of my program increases without stopping. When I want to esc, an error message occurs "Debug Error ...path../.exe Damage: After Normal block (#1773 at 0x09f3ae58. Please retry t debug application".

    How can I solve this problem?

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Memory Problem

    Be sure that the part that reads the bmp and does glTexImage2D is called only _once_ near the start of the program, and NOT called at each display refresh.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    2

    Re: Memory Problem

    At each display refresh I call glTexImage2D. The program is working as I want. But memory usage of my program increases without stopping.

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2008
    Location
    Hungary
    Posts
    8

    Re: Memory Problem

    You have to call glTexImage2D only once, at loading. After that use glBindTexture(GL_TEXTURE_2D, texture_id);
    Your program uploads the texture to the video ram every frame.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,654

    Re: Memory Problem

    Quote Originally Posted by İsmail
    At each display refresh I call glTexImage2D. The program is working as I want. But memory usage of my program increases without stopping.
    That's one reason why. Here's the way to think about this API call:

    * glTexImage2D: malloc and memcpy
    * glTexSubImage2D: memcpy

    You call glTexImage2D "once" per MIPmap level to allocate. You can even call it with a NULL pointer (with no PBO bound) to do the malloc but not the memcpy (i.e. leave the contents of the memory block unspecified). Then you call glTexSubImage2D one or more times to change the contents of that MIPmap's memory block.

Similar Threads

  1. Out of memory problem
    By ngavrilov in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 04-24-2012, 03:00 AM
  2. Replies: 9
    Last Post: 11-15-2010, 03:15 AM
  3. copy from global memory to local memory..problem
    By phoebe0105 in forum OpenCL
    Replies: 3
    Last Post: 06-03-2010, 03:14 PM
  4. Out of memory problem...
    By UT666 in forum OpenGL: Advanced Coding
    Replies: 21
    Last Post: 07-17-2006, 02:07 PM
  5. Video memory and AGP memory problem
    By dilectio in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 12-02-2002, 04:39 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