opengl_x11

Playing with OpenGL
git clone git://bsandro.tech/opengl_x11
Log | Files | Refs | README | LICENSE

commit 514631bf341f07cb92ea4825d827a4288173aea6
parent 178b30516d7089192ab60973d7b2ab5a2edea450
Author: bsandro <email@bsandro.tech>
Date:   Thu, 25 Dec 2025 22:07:25 +0200

random fixes

Diffstat:
MMakefile | 4++--
Mastc.h | 3++-
Msphere.c | 4++--
Mtesselating.c | 11+++++------
4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,6 +1,6 @@ .SUFFIXES: MAKEFLAGS+=-rR -CFLAGS=-std=gnu23 -Wpedantic -Wunused -Os -s -fomit-frame-pointer -ffast-math -fno-stack-protector -march=native -fwrapv -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-unwind-tables -fmerge-all-constants -fno-ident +CFLAGS=-std=gnu23 -Wpedantic -Wall -Wextra -Wunused -Os -s -fomit-frame-pointer -ffast-math -fno-stack-protector -march=native -fwrapv -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables -fno-unwind-tables -fmerge-all-constants -fno-ident LDFLAGS=-lm -lGL -lGLU -lX11 -Wl,--gc-sections CC=cc @@ -16,7 +16,7 @@ CC=cc %.bin: %.c ${CC} $< $(CFLAGS) $(LDFLAGS) -o $@ strip -S --strip-unneeded --remove-section=.note.gnu.gold-version --remove-section=.comment --remove-section=.note --remove-section=.note.gnu.build-id --remove-section=.note.ABI-tag $@ - upx -9 $@ +# upx -9 $@ micro: clean ${CC} -Os -s -fomit-frame-pointer -nostdlib micro.c -o micro0 -Wl,-dynamic-linker,/usr/lib64/ld-linux-x86-64.so.2 -Wl,--no-as-needed /usr/lib64/libdl.so.2 /usr/lib64/libc.so diff --git a/astc.h b/astc.h @@ -4,6 +4,7 @@ #include <GL/gl.h> #include <GL/glx.h> #include <GL/glu.h> +#include <inttypes.h> #define GL_CHECK(x) \ x; \ @@ -61,7 +62,7 @@ static GLuint mkTextureAstc(const char *filename) { int64_t fsize = ftell(f); rewind(f); - printf("astc file size: %lld bytes\n", fsize); + printf("astc file size: %"PRIi64" bytes\n", fsize); uint8_t *data = malloc(fsize); if (fread(data, 1, fsize, f) != fsize) { diff --git a/sphere.c b/sphere.c @@ -159,10 +159,10 @@ void generateElements(int stacks, int sectors, GLuint outElements[]) { } } } - printf("elements offset: %lu\n", offset); + printf("elements offset: %"PRIu32"\n", offset); } -int main(int argc, char *argv[]) { +int main(void) { Display *dpy = XOpenDisplay(NULL); XSetWindowAttributes swa; Window win; diff --git a/tesselating.c b/tesselating.c @@ -16,7 +16,7 @@ #define CALLBACK void (*)(void) #endif -static const double current_ts() { +static double current_ts() { struct timespec ts; timespec_get(&ts, TIME_UTC); return (double)ts.tv_sec + (double)ts.tv_nsec/1e9; @@ -26,19 +26,19 @@ static double t_started; static void tessCbBegin(GLenum type) { glBegin(type); - printf("glBegin(%d)\n", type); + //printf("glBegin(%d)\n", type); } static void tessCbVertex(void *data) { const float scale = 0.2f; const GLdouble *p = data; glVertex3d(p[0]*scale, p[1]*scale, p[2]); - printf("glVertex3d(%.1f, %.1f, %.1f)\n", *p, *(p+1), *(p+2)); + //printf("glVertex3d(%.1f, %.1f, %.1f)\n", *p, *(p+1), *(p+2)); } static void tessCbEnd() { glEnd(); - printf("glEnd()\n"); + //printf("glEnd()\n"); } static void tessCbError(GLenum errno) { @@ -116,12 +116,11 @@ void __attribute((destructor)) end() { printf("end()\n"); } -int main(int argc, char *argv[]) { +int main(void) { Display *dpy = XOpenDisplay(NULL); XSetWindowAttributes swa; Window win; XWindowAttributes gwa; - XEvent xev; GLint attr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, GLX_DOUBLEBUFFER, None }; if (dpy == NULL) {