shithub: tinygl

Download patch

ref: f309b6ddcca27bdc4681cf61d87672a38fc2aa1f
parent: a56648c28c1cd33fc1fb12c0e8995c70500bb19a
author: David <gek@katherine>
date: Fri Feb 19 17:42:01 EST 2021

glDrawArrays

--- a/README.md
+++ b/README.md
@@ -85,6 +85,8 @@
 
 * Tuned the transformations to absolute perfection
 
+* Added glDrawArrays
+
 
 Note that this Softrast **is not GL 1.1 compliant** and does not constitute a complete GL implementation.
 
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -732,6 +732,10 @@
 void glBegin(GLint type);
 void glEnd(void);
 
+
+void glDrawArrays(	GLenum mode,
+ 					GLint first,
+ 					GLsizei count);
 //NEW functions added by GEK!!!
 void glSetEnableSpecular(GLint s); //Toggle specular rendering (Speedup!!!)
 void* glGetTexturePixmap(GLint text, GLint level, GLint* xsize, GLint* ysize); //Get the raw data of a texture!
--- a/src/arrays.c
+++ b/src/arrays.c
@@ -57,6 +57,18 @@
 	gl_add_op(p);
 }
 
+void glDrawArrays(	GLenum mode,
+ 					GLint first,
+ 					GLsizei count){
+	//Temporary implementation until I figure out MR's "batch geometry processing" idea
+#include "error_check_no_context.h"
+	GLint end = first+count;
+	glBegin(mode);
+	for(GLint i = first;i<end;i++)
+		glArrayElement(i);
+	glEnd();
+}
+
 void glopEnableClientState(GLContext* c, GLParam* p) { c->client_states |= p[1].i; }
 
 void glEnableClientState(GLenum array) {