ref: cfc18cad149e9b9d9bae05ce50d9a339e19d3aa4
parent: 418ba9c55deace524b3d642952488bf2fe3ed937
author: David <gek@katherine>
date: Mon Mar 8 18:39:58 EST 2021
Automatic commit.
--- a/src/init.c
+++ b/src/init.c
@@ -152,9 +152,9 @@
c->error_flag = GL_NO_ERROR;
#endif
/* allocate GLVertex array */
- c->vertex_max = POLYGON_MAX_VERTEX;
- c->vertex = gl_malloc(POLYGON_MAX_VERTEX * sizeof(GLVertex));
- if(!c->vertex) gl_fatal_error("TINYGL_CANNOT_INIT_OOM");
+ //c->vertex_max = POLYGON_MAX_VERTEX;
+ //c->vertex = gl_malloc(POLYGON_MAX_VERTEX * sizeof(GLVertex));
+ //if(!c->vertex) gl_fatal_error("TINYGL_CANNOT_INIT_OOM");
/* viewport */
v = &c->viewport;
v->xmin = 0;
@@ -342,7 +342,7 @@
void glClose(void) {
GLContext* c = gl_get_context();
GLuint i;
- gl_free(c->vertex);
+ //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]);
--- a/src/vertex.c
+++ b/src/vertex.c
@@ -222,23 +222,23 @@
c->vertex_cnt = cnt;
/* quick fix to avoid crashes on large polygons */
-#if TGL_FEATURE_GL_POLYGON == 1
- if (n >= c->vertex_max) {
- GLVertex* newarray;
- c->vertex_max <<= 1; /* just double size */
- newarray = gl_malloc(sizeof(GLVertex) * c->vertex_max);
-#if TGL_FEATURE_ERROR_CHECK == 1
- if (!newarray)
-#define ERROR_FLAG GL_OUT_OF_MEMORY
-#include "error_check.h"
-#else
- if (!newarray) exit(1);
-#endif
- memcpy(newarray, c->vertex, n * sizeof(GLVertex));
- gl_free(c->vertex);
- c->vertex = newarray;
- }
-#endif
+//#if TGL_FEATURE_GL_POLYGON == 1
+// if (n >= c->vertex_max) {
+// GLVertex* newarray;
+// c->vertex_max <<= 1; /* just double size */
+// newarray = gl_malloc(sizeof(GLVertex) * c->vertex_max);
+//#if TGL_FEATURE_ERROR_CHECK == 1
+// if (!newarray)
+//#define ERROR_FLAG GL_OUT_OF_MEMORY
+//#include "error_check.h"
+//#else
+// if (!newarray) exit(1);
+//#endif
+// memcpy(newarray, c->vertex, n * sizeof(GLVertex));
+// gl_free(c->vertex);
+// c->vertex = newarray;
+// }
+//#endif
/* new vertex entry */
v = &c->vertex[n];
n++;
--- a/src/zgl.h
+++ b/src/zgl.h
@@ -269,8 +269,9 @@
GLint in_begin;
GLint begin_type;
GLint vertex_n, vertex_cnt;
- GLint vertex_max;
- GLVertex* vertex;
+ //GLint vertex_max;
+ //GLVertex vertex*;
+ GLVertex vertex[POLYGON_MAX_VERTEX];
/* opengl 1.1 arrays */
GLfloat* vertex_array;