summaryrefslogtreecommitdiffstats
path: root/hacks/glx/glhanoi.c
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-18 11:55:41 +0100
committerSimon Rettberg2019-02-18 11:55:41 +0100
commitae69a754244c4e475c8d2591772ca8e005071d83 (patch)
tree58b3fa7abc2dcfe3c23e1c0ce108950c720826ab /hacks/glx/glhanoi.c
parentUpdate gitignore (diff)
downloadxscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.tar.gz
xscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.tar.xz
xscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.zip
Update to 5.42
Diffstat (limited to 'hacks/glx/glhanoi.c')
-rw-r--r--hacks/glx/glhanoi.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/hacks/glx/glhanoi.c b/hacks/glx/glhanoi.c
index 865930f..eaf775f 100644
--- a/hacks/glx/glhanoi.c
+++ b/hacks/glx/glhanoi.c
@@ -1012,6 +1012,8 @@ static int drawTube(GLdouble bottomRadius, GLdouble topRadius,
glVertex3f(0.0, y, innerRadius);
glVertex3f(0.0, y, radius);
glEnd();
+ free (cosCache);
+ free (sinCache);
return polys;
}
@@ -1855,7 +1857,7 @@ ENTRYPOINT void reshape_glhanoi(ModeInfo * mi, int width, int height)
h = height / (GLfloat) width;
}
- glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(glhanoi->glx_context));
+ glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *glhanoi->glx_context);
glViewport(0, y, (GLint) width, (GLint) height);
@@ -1962,7 +1964,7 @@ ENTRYPOINT void draw_glhanoi(ModeInfo * mi)
if(!glhanoi->glx_context)
return;
- glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(glhanoi->glx_context));
+ glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *glhanoi->glx_context);
glPolygonMode(GL_FRONT, glhanoi->wire ? GL_LINE : GL_FILL);
@@ -2060,25 +2062,32 @@ ENTRYPOINT Bool glhanoi_handle_event(ModeInfo * mi, XEvent * event)
ENTRYPOINT void free_glhanoi(ModeInfo * mi)
{
+ glhcfg *glh = &glhanoi_cfg[MI_SCREEN(mi)];
int i;
int j;
- glhcfg *glh = &glhanoi_cfg[MI_SCREEN(mi)];
- if (glh->glx_context) {
- glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(glh->glx_context));
- glDeleteLists(glh->floorList, 1);
- glDeleteLists(glh->baseList, 1);
- glDeleteLists(glh->poleList, 1);
- glDeleteLists(glh->textureNames[0], 2);
- for(j = 0; j < glh->numberOfDisks; ++j) {
- glDeleteLists(glh->disk[j].displayList, 1);
- }
- free(glh->disk);
- for(i = 0; i < glh->numberOfPoles; i++) {
- if(glh->pole[i].data != NULL) {
- free(glh->pole[i].data);
- }
- }
- }
+
+ if (!glh->glx_context) return;
+ glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *glh->glx_context);
+
+ free_rotator (glh->the_rotator);
+ if (glh->pole) {
+ for (i = 0; i < glh->numberOfPoles; i++)
+ if (glh->pole[i].data) free (glh->pole[i].data);
+ free (glh->pole);
+ }
+ if (glh->diskPos) free (glh->diskPos);
+ if (glh->trailQ) free (glh->trailQ);
+ if (glh->solveStack) free (glh->solveStack);
+
+ glDeleteLists(glh->floorList, 1);
+ glDeleteLists(glh->baseList, 1);
+ glDeleteLists(glh->poleList, 1);
+ glDeleteLists(glh->textureNames[0], 2);
+ for(j = 0; j < glh->numberOfDisks; ++j) {
+ glDeleteLists(glh->disk[j].displayList, 1);
+ }
+ free(glh->disk);
+ glDeleteTextures (N_TEXTURES, glh->textureNames);
}
XSCREENSAVER_MODULE ("GLHanoi", glhanoi)