shithub: tinygl

Download patch

ref: 1c72eafd3c9621e41723ae6d379dfbb9cebd18ac
parent: 8b60b91ae4d6187e1784d43476e34c5cf056f6c8
author: David <gek@katherine>
date: Wed Mar 3 19:27:49 EST 2021

A

--- a/README.md
+++ b/README.md
@@ -184,12 +184,29 @@
 
 The internal headers are only used while compiling the library,
 
-the external headers (gl.h, zfeatures.h, zbuffer.h) are requires to use the library.
+the external headers (gl.h, zfeatures.h, zbuffer.h) are required to use the library.
 
 You CAN compile the library along with your final program into a single compilation unit without separating out the library.
 
 Doing so is the most likely compiling method for embedded platforms and how I got TinyGL running on the 3DS.
 
+The codebase uses very simple compiler flags to compile- in fact it will compile if you just compile all c files together
+
+in the src/ directory.
+
+You can compile the code yourself without makefiles using these directives:
+```
+# inside the src directory
+gcc -Wno-uninitialized -O3 -c *.c 
+ar rcs libTinyGL.a *.o
+# the library is now compiled
+cp libTinyGL.a ../lib
+cd ..
+cd SDL_Examples/
+# build the menu demo
+gcc -O3 menu.c -o menu -lSDL ../lib/libTinyGL.a -lm
+# gears
+gcc -O3 gears.c -o gears -lSDL ../lib/libTinyGL.a -lm
 ```c
 //First you have to include
 //(Note that you must either link against libTinyGL.a or compile it in the same compilation unit as your program)
--- a/config.mk
+++ b/config.mk
@@ -4,7 +4,7 @@
 CC= gcc
 #CFLAGS= -Wall -w -O3 -g -std=c99 -mtune=native -DNDEBUG
 #CFLAGS= -Wall -w -O3 -g -std=c99 -march=native -DNDEBUG
-CFLAGS= -Wall -O3 -g -std=c99 -DNDEBUG -march=native -ffast-math
+CFLAGS= -Wall -O3 -std=c99 -DNDEBUG
 #CFLAGS= -Wall -O1 -g -std=c99 -Wno-undef -DNDEBUG
 LFLAGS=
 
--- a/include/zbuffer.h
+++ b/include/zbuffer.h
@@ -354,9 +354,9 @@
 #else
 #include<string.h>
 #include<stdlib.h>
-inline void gl_free(void* p) { free(p); }
-inline void* gl_malloc(GLint size) { return malloc(size); }
-inline void* gl_zalloc(GLint size) { return calloc(1, size); }
+static inline void gl_free(void* p) { free(p); }
+static inline void* gl_malloc(GLint size) { return malloc(size); }
+static inline void* gl_zalloc(GLint size) { return calloc(1, size); }
 #endif
 void gl_memcpy(void* dest, void* src, GLuint size);
 
binary files /dev/null b/include/zfeatures.h.gch differ
--- a/src/Makefile
+++ b/src/Makefile
@@ -11,30 +11,11 @@
 LIB = libTinyGL.a
 
 all: $(LIB)
-#	mv $(LIB) ../lib/
 
 $(LIB): $(OBJS)
 	rm -f $(LIB)
 	ar rcs $(LIB) $(OBJS)
-	
-#SDL_Examples:
-#	cd SDL_Examples && $(MAKE) && cd ..
 clean:
 	rm -f *~ *.o *.a
-#	cd SDL_Examples && $(MAKE) clean && cd ..
 .c.o:
-	$(CC) $(CFLAGS) $(INCLUDES) -c $*.c
-
-clip.o: zgl.h ../include/zfeatures.h
-vertex.o: zgl.h ../include/zfeatures.h
-light.o: zgl.h ../include/zfeatures.h
-matrix.o: zgl.h ../include/zfeatures.h
-list.o: zgl.h opinfo.h ../include/zfeatures.h
-arrays.c: zgl.h ../include/zfeatures.h
-specbuf.o: zgl.h ../include/zfeatures.h
-glx.o: zgl.h ../include/zfeatures.h
-nglx.o: zgl.h ../include/zfeatures.h
-zline.o: zgl.h ../include/zfeatures.h zline.h
-
-ztriangle.o: ztriangle.c ztriangle.h zgl.h ../include/zfeatures.h
-	$(CC) $(CFLAGS) -Wno-uninitialized $(INCLUDES) -c $*.c
+	$(CC) $(CFLAGS) -Wno-uninitialized -c $*.c
--- /dev/null
+++ b/src/Makefile_Backup
@@ -1,0 +1,40 @@
+include ../config.mk
+
+OBJS= api.o list.o vertex.o init.o matrix.o texture.o \
+      misc.o clear.o light.o clip.o select.o get.o \
+      zbuffer.o zline.o ztriangle.o \
+      zmath.o image_util.o msghandling.o \
+      arrays.o specbuf.o memory.o ztext.o zraster.o accum.o
+
+
+INCLUDES = -I./include
+LIB = libTinyGL.a
+
+all: $(LIB)
+#	mv $(LIB) ../lib/
+
+$(LIB): $(OBJS)
+	rm -f $(LIB)
+	ar rcs $(LIB) $(OBJS)
+	
+#SDL_Examples:
+#	cd SDL_Examples && $(MAKE) && cd ..
+clean:
+	rm -f *~ *.o *.a
+#	cd SDL_Examples && $(MAKE) clean && cd ..
+.c.o:
+	$(CC) $(CFLAGS) $(INCLUDES) -c $*.c
+
+clip.o: zgl.h ../include/zfeatures.h
+vertex.o: zgl.h ../include/zfeatures.h
+light.o: zgl.h ../include/zfeatures.h
+matrix.o: zgl.h ../include/zfeatures.h
+list.o: zgl.h opinfo.h ../include/zfeatures.h
+arrays.c: zgl.h ../include/zfeatures.h
+specbuf.o: zgl.h ../include/zfeatures.h
+glx.o: zgl.h ../include/zfeatures.h
+nglx.o: zgl.h ../include/zfeatures.h
+zline.o: zgl.h ../include/zfeatures.h zline.h
+
+ztriangle.o: ztriangle.c ztriangle.h zgl.h ../include/zfeatures.h
+	$(CC) $(CFLAGS) -Wno-uninitialized $(INCLUDES) -c $*.c
binary files /dev/null b/src/zgl.h.gch differ