shithub: tinygl

Download patch

ref: 0ce9b9601ad5305286dfa5eddce261bc5d2200e1
parent: 8b352dd606c068b5ed01a045ed9545e35f63fbc1
author: David <gek@katherine>
date: Sun Mar 14 13:09:16 EDT 2021

Automatic commit.

--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -148,6 +148,16 @@
 	GL_LIST_INDEX			= 0x0B33,
 	GL_LIST_MODE			= 0x0B30,
 
+	/*TinyGL Extension queries, they all start with 0xf*/
+	GL_POLYGON_MAX_VERTEX = 0xf001,
+	GL_MAX_BUFFERS = 0xf002,
+	GL_TEXTURE_HASH_TABLE_SIZE = 0xf003,
+	GL_MAX_TEXTURE_LEVELS = 0xf004,
+	GL_MAX_SPECULAR_BUFFERS = 0xf005,
+	GL_MAX_DISPLAY_LISTS = 0xf006,
+	GL_ERROR_CHECK_LEVEL = 0xf007,
+	GL_IS_SPECULAR_ENABLED = 0xf008,
+	
 	/* Depth buffer */
 	GL_NEVER			= 0x0200,
 	GL_LESS				= 0x0201,
binary files a/include/zfeatures.h.gch /dev/null differ
--- a/src/get.c
+++ b/src/get.c
@@ -170,6 +170,13 @@
 	GLContext* c = gl_get_context();
 	GLint i = 0;
 	switch (pname) {
+	case GL_MAX_BUFFERS:
+		*params = MAX_BUFFERS;
+		break;
+	case GL_TEXTURE_HASH_TABLE_SIZE:
+		*params = TEXTURE_HASH_TABLE_SIZE;
+		break;
+	
 	case GL_LIGHT15:
 		i++;
 	case GL_LIGHT14:
@@ -253,12 +260,17 @@
 		params[1] = c->polygon_mode_back;
 		break;
 	case GL_LIST_MODE:
-		params[0] = c->compile_flag;
+		if(c->compile_flag && !c->exec_flag)
+			params[0] = GL_COMPILE;
+		else if(c->exec_flag && c->compile_flag)
+			params[0] = GL_COMPILE_AND_EXECUTE;
+		else
+			params[0] = 0;
 		break;
 	case GL_LIST_BASE:
 		*params = c->listbase;
 	break;
-	case GL_LIST_INDEX:
+	case GL_LIST_INDEX: //TODO
 		params[0] = 0;
 		break;
 	case GL_TEXTURE_2D:
@@ -362,6 +374,9 @@
 	case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
 		params[0] = 0;
 		break;
+	case GL_POLYGON_MAX_VERTEX:
+		params[0] = POLYGON_MAX_VERTEX;
+		break;
 	case GL_MAX_VIEWPORT_DIMS:
 		params[0] = 4096;
 		params[1] = 4096;
@@ -443,6 +458,29 @@
 		params[2] = c->viewport.xsize;
 		params[3] = c->viewport.ysize;
 		break;
+	case GL_MAX_SPECULAR_BUFFERS:
+#if TGL_FEATURE_SPECULAR_BUFFERS == 1
+		*params = MAX_SPECULAR_BUFFERS;
+#else
+		*params = 0;
+#endif
+		break;
+	case GL_MAX_DISPLAY_LISTS:
+		*params = MAX_DISPLAY_LISTS;
+		break;
+	case GL_ERROR_CHECK_LEVEL:
+#if TGL_FEATURE_STRICT_OOM_CHECKS == 1
+		*params = 2;
+#elif TGL_FEATURE_ERROR_CHECK == 1
+		*params = 1;
+#else
+		*params = 0;
+#endif
+		break;
+	//->zEnableSpecular
+	case GL_IS_SPECULAR_ENABLED:
+		*params = c->zEnableSpecular;
+	break;
 	case GL_MAX_MODELVIEW_STACK_DEPTH:
 		*params = MAX_MODELVIEW_STACK_DEPTH;
 		break;
@@ -454,6 +492,9 @@
 		break;
 	case GL_MAX_TEXTURE_STACK_DEPTH:
 		*params = MAX_TEXTURE_STACK_DEPTH;
+		break;
+	case GL_MAX_TEXTURE_LEVELS:
+		*params = MAX_TEXTURE_LEVELS;
 		break;
 	case GL_GREEN_BITS:
 #if TGL_FEATURE_RENDER_BITS == 16
--- a/src/zgl.h
+++ b/src/zgl.h
@@ -1,5 +1,8 @@
 #ifndef _tgl_zgl_h_
 #define _tgl_zgl_h_
+#ifndef NDEBUG
+#define NDEBUG 
+#endif
 #include "../include/GL/gl.h"
 #include "../include/zfeatures.h"
 #include "../include/zbuffer.h"
@@ -12,9 +15,7 @@
 #define M_PI 3.1415926535897932384626433832795
 #endif
 //#define DEBUG
-#ifndef NDEBUG
-#define NDEBUG 
-#endif
+
 enum {
 
 #define ADD_OP(a, b, c) OP_##a,
@@ -23,7 +24,6 @@
 
 };
 
-/* initially # of allocated GLVertexes (will grow when necessary) */
 //
 #if TGL_FEATURE_GL_POLYGON == 1
 //Large enough for your nice juicy GL_POLYGONs
@@ -43,7 +43,7 @@
 #define MAX_MODELVIEW_STACK_DEPTH 32
 #define MAX_PROJECTION_STACK_DEPTH 8
 #define MAX_TEXTURE_STACK_DEPTH 8
-#define MAX_NAME_STACK_DEPTH 64
+#define MAX_NAME_STACK_DEPTH 16
 #define MAX_TEXTURE_LEVELS 1
 #define MAX_LIGHTS 16