shithub: tinygl

Download patch

ref: 850d4c3da6cdb2876d07d780cf36baf42a72e66c
parent: 5f5481a532f6a0b39efca99810517fdb38a9b03e
author: David <gek@katherine>
date: Thu Mar 11 08:53:40 EST 2021

Automatic commit.

--- a/SDL_Examples/menu.c
+++ b/SDL_Examples/menu.c
@@ -163,6 +163,8 @@
 		puts("Entry 2");
 	if(omg_textbox(0.01, 0.4,   "\nEntry 3\n", 24, 1,   0.4, 0.2, 0xFFFFFF, 0) && omg_cb == 2)
 		puts("Entry 3");
+	if(omg_textbox(0.01, 0.6,   "\nQuit\n", 24, 1,   0.4, 0.2, 0xFFFFFF, 0) && omg_cb == 2)
+		{puts("Quitting...");isRunning = 0;}
 	
 	if(
 	omg_textbox(tbcoords.d[0], tbcoords.d[1], "\nClick me and I toggle color!\n", 16, 1, 0.4, 0.3, 0xFFFFFF, haveclicked?0xFF0000:0x00) && omg_cb == 1)
--- a/src/init.c
+++ b/src/init.c
@@ -334,11 +334,8 @@
 void glClose(void) {
 	GLContext* c = gl_get_context();
 	GLuint i;
-	//gl_free(c->vertex);
 	for (i = 0; i < 3; i++) {
-		// c->matrix_stack[i] = gl_zalloc(c->matrix_stack_depth_max[i] * sizeof(M4));
 		gl_free(c->matrix_stack[i]);
-		// c->matrix_stack_ptr[i] = c->matrix_stack[i];
 	}
 	i = 0;
 #if TGL_FEATURE_SPECULAR_BUFFERS == 1
@@ -350,5 +347,4 @@
 	}
 #endif
 	endSharedState(c);
-	//gl_free(c);
 }
--- a/src/matrix.c
+++ b/src/matrix.c
@@ -78,8 +78,11 @@
 	GLint n = c->matrix_mode;
 	M4* m;
 
-	//TODO add error check.
-	//assert((c->matrix_stack_ptr[n] - c->matrix_stack[n] + 1) < c->matrix_stack_depth_max[n]);
+#if TGL_FEATURE_ERROR_CHECK == 1
+	if(!((c->matrix_stack_ptr[n] - c->matrix_stack[n] + 1) < c->matrix_stack_depth_max[n]))
+	#define ERROR_FLAG GL_INVALID_OPERATION
+	#include "error_check.h"
+#endif
 
 	m = ++c->matrix_stack_ptr[n];
 
@@ -92,6 +95,12 @@
 	GLint n = c->matrix_mode;
 
 	//assert(c->matrix_stack_ptr[n] > c->matrix_stack[n]);
+
+#if TGL_FEATURE_ERROR_CHECK == 1
+	if(!(c->matrix_stack_ptr[n] > c->matrix_stack[n]))
+	#define ERROR_FLAG GL_INVALID_OPERATION
+	#include "error_check.h"
+#endif
 	c->matrix_stack_ptr[n]--;
 	gl_matrix_update(c);
 }