mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
jinx: remove tinygl port
This commit is contained in:
@@ -1,188 +0,0 @@
|
||||
diff -ruN tinygl/config.mk Astral/sources/tinygl/config.mk
|
||||
--- tinygl/config.mk 2022-10-12 19:26:26.106556442 -0300
|
||||
+++ Astral/sources/tinygl/config.mk 2022-10-12 19:19:56.666559485 -0300
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#CC= clang
|
||||
#CC=cc
|
||||
-CC=gcc
|
||||
+CC=x86_64-astral-gcc
|
||||
#CC=tcc
|
||||
#uncomment the following line for compiling the lib using tinyc.
|
||||
#note that the demos will fail to build with tinyc, but you can
|
||||
@@ -15,16 +15,11 @@
|
||||
#extract the maximum possible performance from gcc.
|
||||
|
||||
|
||||
-#CFLAGS= -Wall -O3 -std=c99 -DNDEBUG -march=native -Wno-unused-function
|
||||
-CFLAGS= -Wall -O3 -std=c99 -DNDEBUG -march=native -fopenmp -Wno-unused-function
|
||||
-#CFLAGS_LIB= -Wall -O3 -std=c99 -pedantic -DNDEBUG -march=native -Wno-unused-function
|
||||
-CFLAGS_LIB= -Wall -O3 -std=c99 -pedantic -DNDEBUG -fopenmp -march=native -Wno-unused-function
|
||||
-
|
||||
|
||||
#CFLAGS= -Wall -Ofast -std=gnu99 -DNDEBUG -mtune=native
|
||||
#uncomment the following line for compiling the lib with tinyc
|
||||
#keep these flags for compiling with gcc if you are linking with tinygl compiled with tcc.
|
||||
-#CFLAGS= -Wall -O3 -std=gnu99 -DNDEBUG -g
|
||||
+CFLAGS= -Wall -O3 -std=gnu99 -DNDEBUG -g
|
||||
#CFLAGS= -Wall -O1 -g -std=c99 -Wno-undef -DNDEBUG
|
||||
LFLAGS=
|
||||
|
||||
diff -ruN tinygl/Makefile Astral/sources/tinygl/Makefile
|
||||
--- tinygl/Makefile 2022-10-12 19:26:26.089889775 -0300
|
||||
+++ Astral/sources/tinygl/Makefile 2022-10-12 19:19:56.666559485 -0300
|
||||
@@ -1,9 +1,10 @@
|
||||
|
||||
LIBNAME=libTinyGL.a
|
||||
+PREFIX=/usr/local/
|
||||
LIB=lib/$(LIBNAME)
|
||||
-LIBDIR=/usr/local/lib
|
||||
-INCDIR=/usr/local/include
|
||||
-BINDIR=/usr/local/bin
|
||||
+LIBDIR=$(DESTDIR)/$(PREFIX)/lib
|
||||
+INCDIR=$(DESTDIR)/$(PREFIX)/include
|
||||
+BINDIR=$(DESTDIR)/$(PREFIX)/bin
|
||||
|
||||
all: $(LIB) RDMOS
|
||||
@echo Done!
|
||||
@@ -13,8 +14,10 @@
|
||||
cp src/*.a ./lib/
|
||||
|
||||
install: $(LIB)
|
||||
+ [ -d $(INCDIR)/tinygl ] || mkdir -p $(INCDIR)/tinygl
|
||||
+ [ -d $(LIBDIR)/ ] || mkdir -p $(LIBDIR)
|
||||
+ [ -d $(BINDIR)/ ] || mkdir -p $(BINDIR)
|
||||
cp $(LIB) $(LIBDIR)
|
||||
- mkdir $(INCDIR)/tinygl || echo "You installed before?"
|
||||
cp -r include/* $(INCDIR)/tinygl
|
||||
|
||||
uninstall:
|
||||
diff -ruN tinygl/Raw_Demos/gears.c Astral/sources/tinygl/Raw_Demos/gears.c
|
||||
--- tinygl/Raw_Demos/gears.c 2022-10-12 19:26:26.089889775 -0300
|
||||
+++ Astral/sources/tinygl/Raw_Demos/gears.c 2022-10-12 19:20:49.683225732 -0300
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
+#include <errno.h>
|
||||
+#include <linux/fb.h>
|
||||
+#include <fcntl.h>
|
||||
|
||||
//Doesn't drag in anything.
|
||||
#include "../include/GL/gl.h"
|
||||
@@ -293,10 +296,79 @@
|
||||
// glEnable( GL_NORMALIZE );
|
||||
}
|
||||
|
||||
+static int seekordie(int fd, off_t offset, int whence){
|
||||
+ int ret = lseek(fd, offset, whence);
|
||||
+ if(ret == -1){
|
||||
+ printf("gears: lseek failed on fd %d: %s", fd, strerror(errno));
|
||||
+ exit(errno);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int ioctlordie(int fd, unsigned long request, void* arg){
|
||||
+ int ret = ioctl(fd, request, arg);
|
||||
+ if(ret == -1){
|
||||
+ printf("gears: ioctl failed on fd %d: %s\n", fd, strerror(errno));
|
||||
+ exit(errno);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int openordie(char* name, int flags, int mode){
|
||||
+ int fd = open(name, flags, mode);
|
||||
+ if(fd == -1){
|
||||
+ printf("gears: failed to open %s: %s\n", name, strerror(errno));
|
||||
+ exit(errno);
|
||||
+ }
|
||||
+ return fd;
|
||||
+}
|
||||
+
|
||||
+static int writeordie(int fd, void* buff, size_t count){
|
||||
+ int writec = write(fd, buff, count);
|
||||
+ if(writec == -1){
|
||||
+ printf("gears: write failed on fd %d: %s\n", fd, strerror(errno));
|
||||
+ exit(errno);
|
||||
+ }
|
||||
+
|
||||
+ return writec;
|
||||
+}
|
||||
+
|
||||
+static int readordie(int fd, void* buff, size_t count){
|
||||
+ int readc = read(fd, buff, count);
|
||||
+ if(readc == -1){
|
||||
+ printf("gears: read failed on fd %d: %s\n", fd, strerror(errno));
|
||||
+ exit(errno);
|
||||
+ }
|
||||
+ return readc;
|
||||
+}
|
||||
+
|
||||
+void usage(){
|
||||
+ printf("Usage: gears [options]\n");
|
||||
+ printf("--help Display this information.\n");
|
||||
+ printf("-w <width> Set width of the window\n");
|
||||
+ printf("-h <height> Set height of the window\n");
|
||||
+ printf("-flat\n");
|
||||
+ printf("-smooth\n");
|
||||
+ printf("-blend\n");
|
||||
+ printf("-nospecular\n");
|
||||
+ printf("-lines\n");
|
||||
+ printf("-points\n");
|
||||
+ printf("-notext\n");
|
||||
+}
|
||||
+
|
||||
int main(int argc, char** argv) {
|
||||
// initialize SDL video:
|
||||
- int winSizeX = 640;
|
||||
- int winSizeY = 480;
|
||||
+
|
||||
+ int fbfd = openordie("/dev/fb0", O_RDONLY, 0);
|
||||
+
|
||||
+ struct fb_var_screeninfo fbvs;
|
||||
+ struct fb_fix_screeninfo fbfs;
|
||||
+
|
||||
+ ioctlordie(fbfd, FBIOGET_VSCREENINFO, &fbvs);
|
||||
+ ioctlordie(fbfd, FBIOGET_FSCREENINFO, &fbfs);
|
||||
+
|
||||
+ int winSizeX = fbvs.xres;
|
||||
+ int winSizeY = fbvs.yres;
|
||||
PIXEL* imbuf = NULL;
|
||||
uchar* pbuf = NULL;
|
||||
unsigned int flat = 0;
|
||||
@@ -324,6 +396,10 @@
|
||||
override_drawmodes = 2;
|
||||
if (!strcmp(argv[i],"-notext"))
|
||||
dotext = 0;
|
||||
+ if (!strcmp(argv[i],"--help")){
|
||||
+ usage();
|
||||
+ exit(0);
|
||||
+ }
|
||||
larg = argv[i];
|
||||
}
|
||||
}
|
||||
@@ -413,16 +489,17 @@
|
||||
if(frames > 0) break;
|
||||
}
|
||||
if(TGL_FEATURE_RENDER_BITS == 32){ //very little conversion.
|
||||
- pbuf = malloc(3 * winSizeX * winSizeY);
|
||||
+ pbuf = malloc(4 * winSizeX * winSizeY);
|
||||
for(int i = 0; i < winSizeX * winSizeY; i++){
|
||||
//pbuf[3*i+0] = (imbuf[i]&0xff0000)>>16;
|
||||
//pbuf[3*i+1] = (imbuf[i]&0x00ff00)>>8;
|
||||
//pbuf[3*i+2] = (imbuf[i]&0x0000ff);
|
||||
- pbuf[3*i+0] = GET_RED(imbuf[i]);
|
||||
- pbuf[3*i+1] = GET_GREEN(imbuf[i]);
|
||||
- pbuf[3*i+2] = GET_BLUE(imbuf[i]);
|
||||
+ pbuf[4*i+0] = GET_RED(imbuf[i]);
|
||||
+ pbuf[4*i+1] = GET_GREEN(imbuf[i]);
|
||||
+ pbuf[4*i+2] = GET_BLUE(imbuf[i]);
|
||||
}
|
||||
- stbi_write_png("render.png", winSizeX, winSizeY, 3, pbuf, 0);
|
||||
+
|
||||
+ writeordie(fbfd, pbuf, 4 * winSizeX * winSizeY);
|
||||
free(imbuf);
|
||||
free(pbuf);
|
||||
} else if(TGL_FEATURE_RENDER_BITS == 16){
|
||||
@@ -1,25 +0,0 @@
|
||||
name=tinygl
|
||||
revision=1
|
||||
from_source=tinygl
|
||||
imagedeps="base-devel"
|
||||
hostdeps="gcc-cross binutils-cross"
|
||||
deps="mlibc"
|
||||
|
||||
|
||||
configure() {
|
||||
|
||||
true
|
||||
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
make -C ${source_dir} CC=x86_64-astral-gcc
|
||||
|
||||
}
|
||||
|
||||
install() {
|
||||
|
||||
make -C ${source_dir} install PREFIX=${prefix} DESTDIR=${dest_dir}
|
||||
cp ${source_dir}/Raw_Demos/{bigfont,asciifractal.sh,gears,t2i} ${dest_dir}/usr/bin/
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
name=tinygl
|
||||
version=0.0.0
|
||||
source_method=git
|
||||
clone_url="https://github.com/C-Chads/tinygl.git"
|
||||
tag=main
|
||||
regenerate() {
|
||||
true
|
||||
}
|
||||
Reference in New Issue
Block a user