shithub: tinygl

Download patch

ref: e7185872c6e8b694726ea53796e220e6385384a9
parent: 5a88e8bfa1dca4da516339f409bc35e5df7c824e
author: MHS <gek@katherine>
date: Mon Mar 15 12:36:09 EDT 2021

Automatic commit.

--- a/SDL_Examples/texture.c
+++ b/SDL_Examples/texture.c
@@ -33,6 +33,7 @@
 #endif
 
 GLuint tex = 0;
+GLuint tex2 = 0;
 GLuint do1D = 0;
 GLint Row1D = 30;
 GLint dorect = 0;
@@ -137,6 +138,16 @@
 			printf("\nCan't load texture!\n");
 		}
 	}
+	{
+		int sw = 0, sh = 0, sc = 0; // sc goes unused.
+		uchar* source_data = stbi_load("tex.jpg", &sw, &sh, &sc, 3);
+		if (source_data) {
+			tex2 = loadRGBTexture(source_data, sw, sh);
+			free(source_data);
+		} else {
+			printf("\nCan't load texture!\n");
+		}
+	}
 	glEnable(GL_NORMALIZE);
 }
 
@@ -285,7 +296,7 @@
 		glRasterPos3f(0,-1,fabs(sinf(frames_notreset/200.0)));
 		{
 			GLint xsize, ysize;
-			void* data = glGetTexturePixmap(tex, 0, &xsize,  &ysize);
+			void* data = glGetTexturePixmap(tex2, 0, &xsize,  &ysize);
 			//for(int i = 0; i < winSizeX; i++)
 			//for(int j = 0; j < winSizeY; j++){
 				//glPlotPixel(i,j,rand() & 0xFFFFFF);
--- a/config.mk
+++ b/config.mk
@@ -4,7 +4,9 @@
 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 -std=gnu99 -DNDEBUG -g -fopenmp -Wno-uninitialized
+#CFLAGS= -Wall -O3 -std=gnu99 -DNDEBUG -g -Wno-uninitialized
 #CFLAGS= -Wall -O1 -g -std=c99 -Wno-undef -DNDEBUG
 LFLAGS=
 
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -748,7 +748,7 @@
 #error C99 Compiler Using Non-Compliant Float Type! Compatibility not guaranteed.
 #endif
 #else
-#warning "Cannot test __STDC_IEC_559__, it is not defined."
+//#warning "Cannot test __STDC_IEC_559__, it is not defined."
 #endif
 //extern char __BUILDT_error[ 1-2*(sizeof(GLbyte) != 4)];
 extern char TGL_BUILDT_GLshort[ 1-2*(sizeof(GLshort) != 2)];
--- a/src/msghandling.c
+++ b/src/msghandling.c
@@ -1,13 +1,17 @@
 #include "../include/GL/gl.h"
 #include "zgl.h"
 #include <stdarg.h>
-#include <stdio.h>
+
 //#define NDEBUG
 
-#ifdef NDEBUG
-//#define NO_DEBUG_OUTPUT
+//TinyC doesnt like my stdio.
+#ifdef __TINYC__
+#define NO_DEBUG_OUTPUT
 #endif
 
+#ifndef NO_DEBUG_OUTPUT
+#include <stdio.h>
+#endif
 /* Use this function to output messages when something unexpected
    happens (which might be an indication of an error). *Don't* use it
    when there's GLinternal errors in the code - these should be handled