ref: fed872f1606278f90db48d27406349cbafb1c855
parent: 656b46af3c851a8f2eae195a5553f79057ffb9b6
author: David <gek@katherine>
date: Thu Mar 11 13:13:40 EST 2021
Automatic commit.
--- a/README.md
+++ b/README.md
@@ -160,7 +160,9 @@
* added Openmp multithreading and glPostProcess()
+* Line rendering now obeys glDepthMask and glDepthTest.
+
Note that this Softrast **is not GL 1.1 compliant** and does not constitute a complete GL implementation.
You *will* have to tweak your code to work with this library. That said, once you have, it will run anywhere that you can get
@@ -169,7 +171,7 @@
Notable limitations:
-* The only supported texture size and format is RGB 256x256
+* The only supported texture size and format is decided at compile time. you can set it in zfeatures.h
* A lot of prototypes are missing.
@@ -233,6 +235,8 @@
gcc -O3 gears.c -o gears -lSDL ../lib/libTinyGL.a -lm
```
+This is how you use TinyGL in a program:
+
```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)
@@ -269,7 +273,8 @@
### WHAT ARE THE MINIMUM REQUIREMENTS OF THIS LIBRARY?
-SDL 1.2 is required to run the demos I've written.
+SDL 1.2 is required to run most of the demos I've written, but if you don't have SDL you can still check out the library
+by compiling one of the "Raw Demos" which write their output to a file (At the time of writing this, only gears has been added.)
SDL is by no means required to compile or use this library.
SDL is used as a reasonable means of displaying the output of TinyGL for testing.
--- a/src/light.c
+++ b/src/light.c
@@ -222,13 +222,14 @@
// FEATURES
void glSetEnableSpecular(GLint s){
GLParam p[2];
+#include "error_check_no_context.h"
p[1].i = s;
p[0].op = OP_SetEnableSpecular;
gl_add_op(p);
}
-void glopSetEnableSpecular(GLParam* p) {
-#include "error_check_no_context.h"
- gl_get_context()->zEnableSpecular = p[0].i;
+void glopSetEnableSpecular(GLParam* p){
+ tgl_warning("\nBeing Called!\n");
+ gl_get_context()->zEnableSpecular = p[1].i;
}
/* non optimized lightening model */
void gl_shade_vertex(GLVertex* v) {
--- a/src/zline.c
+++ b/src/zline.c
@@ -69,6 +69,7 @@
static void ZB_line_flat_z(ZBuffer* zb, ZBufferPoint* p1, ZBufferPoint* p2, GLint color) {
//GLubyte zbdw = zb->depth_write;
GLubyte zbdt = zb->depth_test;
+ GLubyte zbdw = zb->depth_write;
#include "zline.h"
}
@@ -78,6 +79,7 @@
static void ZB_line_interp_z(ZBuffer* zb, ZBufferPoint* p1, ZBufferPoint* p2) {
//GLubyte zbdw = zb->depth_write;
GLubyte zbdt = zb->depth_test;
+ GLubyte zbdw = zb->depth_write;
#include "zline.h"
}
--- a/src/zline.h
+++ b/src/zline.h
@@ -3,7 +3,7 @@
GLint n, dx, dy, sx, pp_inc_1, pp_inc_2;
register GLint a;
register PIXEL* pp;
-#if defined(INTERP_RGB) || TGL_FEATURE_RENDER_BITS == 24
+#if defined(INTERP_RGB)
register GLuint r, g, b;
#endif
#ifdef INTERP_RGB
@@ -34,21 +34,13 @@
r = p2->r << 8;
g = p2->g << 8;
b = p2->b << 8;
-#elif TGL_FEATURE_RENDER_BITS == 24
- /* for 24 bits, we store the colors in different variables */
- r = p2->r >> 8;
- g = p2->g >> 8;
- b = p2->b >> 8;
#endif
#ifdef INTERP_RGB
#define RGB(x) x
-#if TGL_FEATURE_RENDER_BITS == 24
-#define RGBPIXEL pp[0] = r >> 16, pp[1] = g >> 16, pp[2] = b >> 16
-#else
#define RGBPIXEL *pp = RGB_TO_PIXEL(r >> 8, g >> 8, b >> 8)
//#define RGBPIXEL TGL_BLEND_FUNC_RGB(r>>8, g>>8, b>>8, (*pp))
-#endif
+
#else /* INTERP_RGB */
#define RGB(x)
#if TGL_FEATURE_RENDER_BITS == 24
@@ -66,7 +58,7 @@
zz = z >> ZB_POINT_Z_FRAC_BITS; \
if (ZCMP(zz, *pz)) { \
RGBPIXEL; \
- *pz = zz; \
+ if(zbdw) {*pz = zz;} \
} \
}
#else /* INTERP_Z */