ref: 06766bd1561b74aaa5cdd562ce193a08d994a74b
parent: 96472bc52ce103a27f3863b5528d5789090830e8
author: David <gek@katherine>
date: Mon Feb 15 08:00:30 EST 2021
Added new display list functions
--- a/README.md
+++ b/README.md
@@ -85,6 +85,8 @@
### glDrawText(const unsigned char* text, int x, int y, unsigned int pixel)
+This function can be added to display lists.
+
Draws a pre-made 8x8 font to the screen. You can change its displayed size with...
### glTextSize(GLTEXTSIZE mode)
@@ -92,6 +94,8 @@
Set size of text drawn to the buffer in aforementioned function.
### glPlotPixel(int x, int y, unsigned int pixel)
+
+This function can be added to display lists.
Plot pixel directly to the buffer.
--- a/src/opinfo.h
+++ b/src/opinfo.h
@@ -68,4 +68,7 @@
/* opengl 1.1 polygon offset */
ADD_OP(PolygonOffset, 2, "%f %f")
+/* Gek's Added Functions */
+ADD_OP(PlotPixel, 2, "%d %d")
+
#undef ADD_OP
--- a/src/ztext.c
+++ b/src/ztext.c
@@ -25,20 +25,30 @@
}
}
+void glopPlotPixel(GLContext * c,GLParam * p){
+ GLint x = p[1].i;
+ PIXEL pix = p[2].ui;
+ //PIXEL* pbuf = c->zb->pbuf;
+ c->zb->pbuf[x] = pix;
+}
-void glPlotPixel(GLint x, GLint y, GLuint p){
-// GLint x = p[1].i;
-// GLint y = p[2].i;
-// GLuint p = p[3].ui;
-#if TGL_FEATURE_RENDER_BITS == 16
- p = RGB_TO_PIXEL( ( (p & 255) << 8) , ( p & 65280) , ( (p >>16)<<8 ) );
-#endif
- PIXEL* pbuf = gl_get_context()->zb->pbuf;
+void glPlotPixel(GLint x, GLint y, GLuint pix){
+ GLParam p[3];
+
+ //PIXEL* pbuf = gl_get_context()->zb->pbuf;
GLint w = gl_get_context()->zb->xsize;
GLint h = gl_get_context()->zb->ysize;
+ p[0].op = OP_PlotPixel;
- if(x>0 && x<w && y>0 && y < h)
- pbuf[x+y*w] = p;
+
+ if(x>0 && x<w && y>0 && y < h){
+#if TGL_FEATURE_RENDER_BITS == 16
+ pix = RGB_TO_PIXEL( ( (pix & 255) << 8) , ( pix & 65280) , ( (pix >>16)<<8 ) );
+#endif
+ p[1].i = x+y*w;
+ p[2].ui = pix;
+ gl_add_op(p);
+ }
}
void glDrawText(const GLubyte* text, GLint x, GLint y, GLuint p){
if(!text)return;