I have a problem with my assignment ,im implementing a solar system screen saver ,at first i didnt use any textures , it worked fine smooth no problems,then when i used textures ,the memory usage continued to rise until it reaches 1.3GB then the program stops,i used free() delete to deallocate the textures and spheres but still it continues to rise. and here is part of the code,
glPushMatrix();
//GLfloat* arr=&planet_emission[0];
glEnable ( GL_COLOR_MATERIAL ) ;
glMaterialfv( GL_FRONT, GL_EMISSION, planet_emission );
glColor3f(0.5f,0.5f,0.5f);
DrawCircle(10tran);
glColor3f(f1,f2,f3);
glRotated(Orbitcounter,0.0,1.0,0.0);
glTranslated(10tran,0,0);
glRotated(10counter,0.0,0.0,1.0);
GLuint* boxTexture=(GLuint*)malloc(sizeof(GLuint));
FILE* file=(FILE*)malloc(sizeof(FILE));
switch((int)tran){
case 2 :LoadTexture(file,boxTexture,“mercury.ppm”, 256, 256, true);break;
case 3 :LoadTexture(file,boxTexture,“venus.ppm”, 256, 256, true);break;
case 4 :LoadTexture(file,boxTexture,“Earth.ppm”, 720, 360, true);break;
case 5 :LoadTexture(file,boxTexture,“mars.ppm”, 256, 256, true);break;
case 7 :LoadTexture(file,boxTexture,“jupiter.ppm”, 256, 256, true);break;
case 9 :LoadTexture(file,boxTexture,“saturn.ppm”, 256, 256, true);break;
case 11:LoadTexture(file,boxTexture,“uranus.ppm”, 256, 256, true);break;
case 13:LoadTexture(file,boxTexture,“neptune.ppm”, 256, 256, true);break;
case 14:LoadTexture(file,boxTexture,“pluto.ppm”, 256, 256, true);break;
}
GLUquadricObj* sphere = gluNewQuadric();
gluQuadricTexture(sphere, true);
gluQuadricNormals(sphere, GLU_SMOOTH);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, *boxTexture);
glEnable(GL_CULL_FACE);
gluSphere(sphere, Radius, 100, 100);
gluDeleteQuadric(sphere);
glDisable(GL_TEXTURE_2D);
delete boxTexture;
delete file;
glPopMatrix();
//any suggestions