shithub: tinygl

Download patch

ref: 9f1e329ece930416249b9cfc0a425d372a6a3305
parent: dc133d6431539124dcb3e99f9c98f43600775cc2
author: David <gek@katherine>
date: Wed Mar 10 07:44:05 EST 2021

Automatic commit.

--- a/README.md
+++ b/README.md
@@ -292,10 +292,17 @@
 
 * glDrawPixels
 
+Every scanline is drawn by a separate thread.
+
 * glPostProcess
 
-Compile the library with -fopenmp to see them in action!
+Every call of the function pointer is run by a separate thread.
 
+Compile the library with -fopenmp to see them in action. They are used in the texture demo, make sure to add the argument `-pp`
+
+when running the texture demo to get postprocessing (with 32 bit color, the postprocessing step simply halves the pixel color,
+on 16 bit, it isolates the green component.
+
 You do not need a multithreaded processor to use TinyGL!
 
 ### Performance Recommendations
@@ -351,6 +358,28 @@
 may be the site of future hardware acceleration.
 
 Please look at the model.c demo to see how to use these functions. They function very similarly to their GL 2.0+ counterparts.
+
+### glPostProcess(GLuint (*postprocess)(GLint x, GLint y, GLuint pixel, GLushort z))
+
+Fast, Multithreaded Postprocessing for TinyGL. 
+
+You simply send in a function pointer (The function's name) and glPostProcess does the heavy lifting
+
+The return value is the pixel (ARGB or 5R6G5B depending on mode).
+
+x and y are the screen coordinataes.
+
+pixel is the current color value of the pixel, ARGB or 5R6G5B depending on mode.
+
+z is TinyGL's internal Z buffer representation. Larger values are considered to be "in front" of smaller ones.
+
+This function is multithreaded on supported platforms for maximum execution speed. It of course still works without multithreading, but
+
+it will not be as fast.
+
+Note that you may have to take special care to prevent race conditions when using multithreading with this function.
+
+
 
 ## TOGGLEABLE FEATURES
 
--- a/SDL_Examples/texture.c
+++ b/SDL_Examples/texture.c
@@ -67,7 +67,7 @@
 	return pixel & 0x8F8F8F; //Half color mode.
 #else
 //16 bit mode
-	return 63<<5; //Solid green
+	return pixel & (63<<5); //Solid green
 #endif
 }