ref: 9e8a7983fe082d6e674f0279ab0e2bbd2a89b237
parent: 0c541240e5ab5f7fcba508fa20f540b0fa6a95a6
author: David <gek@katherine>
date: Tue Mar 9 21:26:00 EST 2021
Automatic commit.
--- a/README.md
+++ b/README.md
@@ -209,7 +209,8 @@
in the src/ directory.
You can compile the code yourself without makefiles using these directives:
-```
+
+```sh
# inside the src directory
gcc -Wno-uninitialized -O3 -c *.c
ar rcs libTinyGL.a *.o
@@ -221,6 +222,8 @@
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/include/zfeatures.h
+++ b/include/zfeatures.h
@@ -32,6 +32,8 @@
#define TGL_FEATURE_GL_POLYGON 0
//Enable GL_BLEND functionality
#define TGL_FEATURE_BLEND 1
+//Enable blending in glDrawPixels, which slows it down a lot and makes it unsuitable for a lot of things.
+#define TGL_FEATURE_BLEND_DRAW_PIXELS 0
//The width of textures as a power of 2. The default is 8, or 256x256 textures.
#define TGL_FEATURE_TEXTURE_POW2 8
#define TGL_FEATURE_TEXTURE_DIM (1<<TGL_FEATURE_TEXTURE_POW2)
--- a/src/get.c
+++ b/src/get.c
@@ -104,7 +104,9 @@
#if TGL_FEATURE_BLEND == 1
"TGL_FEATURE_BLEND "
#endif
-
+#if TGL_FEATURE_BLEND_DRAW_PIXELS == 1
+"TGL_FEATURE_BLEND_DRAW_PIXELS "
+#endif
#if TGL_FEATURE_NO_DRAW_COLOR == 1
"TGL_FEATURE_NO_DRAW_COLOR "
#endif
--- a/src/zraster.c
+++ b/src/zraster.c
@@ -160,7 +160,9 @@
pz = zbuf + (ty * tw + tx);
if(ZCMP(zz,*pz)){
+
#if TGL_FEATURE_BLEND == 1
+#if TGL_FEATURE_BLEND_DRAW_PIXELS == 1
if(!zbeb)
pbuf[tx+ty*tw] = col;
else
@@ -168,15 +170,13 @@
#else
pbuf[tx+ty*tw] = col;
#endif
+#else
+ pbuf[tx+ty*tw] = col;
+#endif
if(zbdw) *pz = zz;
}
}
}
- /*GLint mult = textsize;
- for (GLint i = 0; i < mult; i++)
- for (GLint j = 0; j < mult; j++)
- glPlotPixel(y * mult + i + _x, x * mult + j + _y, p);
- */
}