mesa: call glutDestroyWindow() on exit to help find mem leaks
This commit is contained in:
parent
fc0a48d587
commit
b86cf71491
|
@ -48,6 +48,7 @@ static GLfloat TexXrot = 0, TexYrot = 0;
|
||||||
static GLfloat Xrot = 20.0, Yrot = 20.0, Zrot = 0.0;
|
static GLfloat Xrot = 20.0, Yrot = 20.0, Zrot = 0.0;
|
||||||
static GLfloat EyeDist = 10;
|
static GLfloat EyeDist = 10;
|
||||||
static GLboolean Anim = GL_TRUE;
|
static GLboolean Anim = GL_TRUE;
|
||||||
|
static int win = 0;
|
||||||
|
|
||||||
|
|
||||||
struct uniform_info {
|
struct uniform_info {
|
||||||
|
@ -177,6 +178,7 @@ key(unsigned char k, int x, int y)
|
||||||
EyeDist = 90;
|
EyeDist = 90;
|
||||||
break;
|
break;
|
||||||
case 27:
|
case 27:
|
||||||
|
glutDestroyWindow(win);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
glutPostRedisplay();
|
glutPostRedisplay();
|
||||||
|
@ -554,7 +556,7 @@ main(int argc, char *argv[])
|
||||||
glutInit(&argc, argv);
|
glutInit(&argc, argv);
|
||||||
glutInitWindowSize(500, 400);
|
glutInitWindowSize(500, 400);
|
||||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||||
glutCreateWindow(Demo);
|
win = glutCreateWindow(Demo);
|
||||||
glutReshapeFunc(Reshape);
|
glutReshapeFunc(Reshape);
|
||||||
glutKeyboardFunc(key);
|
glutKeyboardFunc(key);
|
||||||
glutSpecialFunc(specialkey);
|
glutSpecialFunc(specialkey);
|
||||||
|
|
|
@ -31,6 +31,7 @@ static GLenum Target = GL_TEXTURE_2D;
|
||||||
static GLenum Filter = GL_NEAREST;
|
static GLenum Filter = GL_NEAREST;
|
||||||
GLenum doubleBuffer;
|
GLenum doubleBuffer;
|
||||||
static float Rot = 0;
|
static float Rot = 0;
|
||||||
|
static int win = 0;
|
||||||
|
|
||||||
static void Init(void)
|
static void Init(void)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +89,7 @@ static void Reshape(int width, int height)
|
||||||
glFrustum(-1, 1, -1, 1, 10, 20);
|
glFrustum(-1, 1, -1, 1, 10, 20);
|
||||||
#endif
|
#endif
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
glTranslatef(0, 0, -15);
|
glTranslatef(0, 0, -15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +103,7 @@ static void Key(unsigned char key, int x, int y)
|
||||||
Rot -= 10.0;
|
Rot -= 10.0;
|
||||||
break;
|
break;
|
||||||
case 27:
|
case 27:
|
||||||
|
glutDestroyWindow(win);
|
||||||
exit(0);
|
exit(0);
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
@ -170,7 +173,8 @@ int main(int argc, char **argv)
|
||||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||||
glutInitDisplayMode(type);
|
glutInitDisplayMode(type);
|
||||||
|
|
||||||
if (glutCreateWindow("First Tri") == GL_FALSE) {
|
win = glutCreateWindow("First Tri");
|
||||||
|
if (!win) {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue