I tried to reproduce your bug, when I resize I do the thing you write above and my texture are not cleaned.
Here is my test code:
#include <iostream>
#include <vector>
#include <GL/gl.h>
#include <GL/glu.h>
#include <SDL/SDL.h>
GLuint texID;
void display(void);
void init(void);
void reshape(GLsizei w,GLsizei h);
int main(int argc,char **argv)
{
bool done = false;
bool fullscreen = false;
SDL_Surface *surf;
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,24);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
surf = SDL_SetVideoMode(512,512,32,SDL_OPENGL|SDL_RESIZABLE);
init();
while(!done)
{
SDL_PollEvent(&event);
switch(event.type)
{
case SDL_KEYDOWN:
switch(event.key.keysym.sym)
{
case SDLK_F1:
SDL_WM_ToggleFullScreen(surf);
fullscreen = !fullscreen;
break;
case SDLK_ESCAPE:
done = true;
default:
break;
}
break;
case SDL_VIDEORESIZE:
SDL_FreeSurface(surf);
surf = SDL_SetVideoMode(event.resize.w,event.resize.h,32,SDL_OPENGL|SDL_RESIZABLE);
reshape(static_cast<GLsizei>(event.resize.w),static_cast<GLsizei>(event.resize.h));
break;
case SDL_QUIT:
done = true;
break;
default:
break;
}
display();
}
if(fullscreen == true)
{
SDL_WM_ToggleFullScreen(surf);
}
SDL_Quit();
return (EXIT_SUCCESS);
}
/*-----------------------------------------*/
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,texID);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
glScalef(0.5,0.5,0.5);
glBegin(GL_TRIANGLE_STRIP);
glColor4f(1.0,1.0,1.0,1.0);
glTexCoord2f(0.0,0.0);
glVertex4f(-1.0,-1.0,0.0,1.0);
glTexCoord2f(1.0,0.0);
glVertex4f(1.0,-1.0,0.0,1.0);
glTexCoord2f(0.0,1.0);
glVertex4f(-1.0,1.0,0.0,1.0);
glTexCoord2f(1.0,1.0);
glVertex4f(1.0,1.0,0.0,1.0);
glEnd();
glDisable(GL_TEXTURE_2D);
SDL_GL_SwapBuffers();
}
/*-------------------------------------------------*/
void init(void)
{
std::vector<GLubyte> texture_data;
texture_data.resize(16);
texture_data[0] = 255;texture_data[1] = 0;texture_data[2] = 0;texture_data[3] = 255;
texture_data[4] = 0;texture_data[5] = 255;texture_data[6] = 0;texture_data[7] = 255;
texture_data[8] = 0;texture_data[9] = 0;texture_data[10] = 255;texture_data[11] = 255;
texture_data[12] = 255;texture_data[13] = 255;texture_data[14] = 0;texture_data[15] = 255;
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glGenTextures(1,&texID);
glBindTexture(GL_TEXTURE_2D,texID);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA8,2,2,0,GL_RGBA,GL_UNSIGNED_BYTE,&texture_data[0]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glDisable(GL_TEXTURE_2D);
}
/*------------------------------------------*/
void reshape(GLsizei w,GLsizei h)
{
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0,1.0,-1.0,1.0,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
}
I am under Linux. Try it to see if the simple texture disappear.