Why is my windows 2000 out of memery when I run my openGL program?

I have written a openGL program in visual c++6.0. I use double color buffers and swap them 10 times a minute to realize animation. When I run my program,my operating system run out of memory after about 1 minute.And I have checked my program without finding any errors?I guess it’s openGL buffers’ fault.Can anyone explain the reasons for this phenomenon. Thanks!! Eager for your help!

hehe, we always think it isn’t our fault when something is going wrong…
I often thought this, but I could always find the error in my code !

Continue searching the error in your code, or show us your code if you want to be helped !

Originally posted by morbac:
Continue searching the error in your code, or show us your code if you want to be helped !

In my program,there are four textures.I load them each time when they are used.I guess it’s the key reason.Do you agree with me?

You mean you completely reload the texture for each use? Like loading it from disk, allocating a texture id and uploading it? And on top of all, not deleting the old texture?

If so, no wonder you run out of memory.

load them and bind them at initialisation. Then call glBind() again in your display routine.

something like that

void init()
{
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &m_Texture);
glBindTexture(GL_TEXTURE_2D, m_Texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, ImageSize, ImageSize,0, GL_RGBA, GL_UNSIGNED_BYTE, Image);

}

void display()
{
glBindTexture(GL_TEXTURE_2D, m_Texture);
}