fix Windows XP build

This commit is contained in:
Zack Buhman 2025-12-18 18:44:36 -06:00
parent f284e80b34
commit 2904160889
5 changed files with 24 additions and 13 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
*.blend1
*.zip
main
*.exe

View File

@ -11,8 +11,8 @@ MAKEFILE_PATH := $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST))))
DEBUG = -g
CSTD += -std=gnu23
CXXSTD += -std=gnu++23
CSTD += -std=gnu11
CXXSTD += -std=gnu++14
CFLAGS += -Wall -Werror -Wfatal-errors
CFLAGS += -Wno-error=unused-function
@ -20,9 +20,9 @@ CFLAGS += -Wno-error=unused-variable
CFLAGS += -I$(MAKEFILE_PATH)/include
CFLAGS += -I$(dir $(GLFW))../include
CXXFLAGS += -fno-exceptions
LDFLAGS += -nostdlib++ -lm -Wl,-z noexecstack
LDFLAGS += -lm -static-libgcc
ifeq ($(shell uname),Linux)
LDFLAGS += -static-libgcc
LDFLAGS += -nostdlib++
endif
ifeq ($(OS),Windows_NT)
LDFLAGS += -Wl,--subsystem,windows -mwindows

View File

@ -41,8 +41,8 @@ inline constexpr mat<4, 4, T> rotate_x(T t)
{
return {
1, 0, 0, 0,
0, cos(t), -sin(t), 0,
0, sin(t), cos(t), 0,
0, cosf(t), -sinf(t), 0,
0, sinf(t), cosf(t), 0,
0, 0, 0, 1
};
}
@ -51,9 +51,9 @@ template <typename T>
inline constexpr mat<4, 4, T> rotate_y(T t)
{
return {
cos(t), 0, sin(t), 0,
cosf(t), 0, sinf(t), 0,
0, 1, 0, 0,
-sin(t), 0, cos(t), 0,
-sinf(t), 0, cosf(t), 0,
0, 0, 0, 1
};
}
@ -62,8 +62,8 @@ template <typename T>
inline constexpr mat<4, 4, T> rotate_z(T t)
{
return {
cos(t), -sin(t), 0, 0,
sin(t), cos(t), 0, 0,
cosf(t), -sinf(t), 0, 0,
sinf(t), cosf(t), 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
@ -149,7 +149,7 @@ template <typename T>
inline constexpr T inverse_length(vec<3, T> v)
{
float f = dot(v, v);
return 1.0f / sqrt<T>(f);
return 1.0f / sqrtf(f);
}
template <typename T>

View File

@ -2,6 +2,7 @@
#include <unistd.h>
#include <math.h>
#include <assert.h>
#include <stdbool.h>
#include "glad/gl.h"
@ -81,8 +82,8 @@ int main()
#endif
glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);
GLFWwindow* window = glfwCreateWindow(vp_width, vp_height, "new", NULL, NULL);
@ -106,6 +107,11 @@ int main()
GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
return -1;
}
printf("%d %d %d\n",
GLAD_GL_ARB_framebuffer_object,
GLAD_GL_ARB_texture_float,
GLAD_GL_ARB_vertex_array_object);
fflush(stdout);
//////////////////////////////////////////////////////////////////////
// meshes
@ -173,6 +179,8 @@ int main()
const double first_frame = glfwGetTime();
double last_frame = first_frame;
fflush(stderr);
while (!glfwWindowShouldClose(window)) {
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);

View File

@ -1,5 +1,7 @@
#version 130
precision highp float;
uniform sampler2D texture0;
in vec2 f_texture;