shithub: tinygl

Download patch

ref: 2993df585b807fcb98a1c6dd0a9b47931c990cd0
parent: 155aaa1821874e9f56d2ee672713bb27bad8e43a
author: David <gek@katherine>
date: Sat Feb 13 08:40:58 EST 2021

glDeleteLists

--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@
 
 ### glDeleteList
 
-Replaces glDeleteLists. Allows you to delete display lists.
+An easier to use version of glDeleteLists. glDeleteLists is also implemented.
 
 ### glSetEnableSpecular(int shouldenablespecular);
 
--- a/src/LIMITATIONS
+++ b/src/LIMITATIONS
@@ -20,6 +20,14 @@
 ************ glPolygonStipple
 OK. (Implemented by Gek! The variables for it are stored per zBuffer rather than per context.)
 
+************ glDeleteList(GLuint list)
+
+OK.
+
+************ glDeleteLists(GLuint list, GLuint range)
+
+OK.
+
 ************ glShadeModel
 
 OK.
--- a/src/SDL_Examples/model.c
+++ b/src/SDL_Examples/model.c
@@ -543,7 +543,8 @@
     printf("%i frames in %f secs, %f frames per second.\n",frames,(float)(tNow-tLastFps)*0.001f,(float)frames*1000.0f/(float)(tNow-tLastFps));
     // cleanup:
 	glDeleteTextures(1, &tex);
-	glDeleteList(modelDisplayList);
+	//glDeleteList(modelDisplayList);
+	glDeleteLists(modelDisplayList, 1);
     ZB_close(frameBuffer);
     
     if(SDL_WasInit(SDL_INIT_VIDEO))
--- a/src/include/GL/gl.h
+++ b/src/include/GL/gl.h
@@ -763,7 +763,8 @@
 void glNewList(unsigned int list,int mode);
 void glEndList(void);
 void glCallList(unsigned int list);
-void glDeleteList(int list);
+void glDeleteList(unsigned int list);
+void glDeleteLists(unsigned int list, unsigned int range);
 /* clear */
 void glClear(int mask);
 void glClearColor(float r,float g,float b,float a);
--- a/src/list.c
+++ b/src/list.c
@@ -39,6 +39,7 @@
   GLList *l;
 
   l=find_list(c,list);
+  if(l==NULL) puts("\nAttempted to delete NULL list!!!!\n");
   assert(l != NULL);
   
   /* free param buffer */
@@ -52,7 +53,11 @@
   gl_free(l);
   c->shared_state.lists[list]=NULL;
 }
-void glDeleteList(int list){
+void glDeleteLists(unsigned int list, unsigned int range){
+	for(unsigned int i = 0; i < list + range; i++)
+		glDeleteList(list+i);
+}
+void glDeleteList(unsigned int list){
 	delete_list(gl_get_context(), list);
 }