fix Windows XP build
This commit is contained in:
parent
f284e80b34
commit
2904160889
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@
|
|||||||
*.blend1
|
*.blend1
|
||||||
*.zip
|
*.zip
|
||||||
main
|
main
|
||||||
|
*.exe
|
||||||
8
Makefile
8
Makefile
@ -11,8 +11,8 @@ MAKEFILE_PATH := $(patsubst %/,%,$(dir $(abspath $(firstword $(MAKEFILE_LIST))))
|
|||||||
|
|
||||||
DEBUG = -g
|
DEBUG = -g
|
||||||
|
|
||||||
CSTD += -std=gnu23
|
CSTD += -std=gnu11
|
||||||
CXXSTD += -std=gnu++23
|
CXXSTD += -std=gnu++14
|
||||||
|
|
||||||
CFLAGS += -Wall -Werror -Wfatal-errors
|
CFLAGS += -Wall -Werror -Wfatal-errors
|
||||||
CFLAGS += -Wno-error=unused-function
|
CFLAGS += -Wno-error=unused-function
|
||||||
@ -20,9 +20,9 @@ CFLAGS += -Wno-error=unused-variable
|
|||||||
CFLAGS += -I$(MAKEFILE_PATH)/include
|
CFLAGS += -I$(MAKEFILE_PATH)/include
|
||||||
CFLAGS += -I$(dir $(GLFW))../include
|
CFLAGS += -I$(dir $(GLFW))../include
|
||||||
CXXFLAGS += -fno-exceptions
|
CXXFLAGS += -fno-exceptions
|
||||||
LDFLAGS += -nostdlib++ -lm -Wl,-z noexecstack
|
LDFLAGS += -lm -static-libgcc
|
||||||
ifeq ($(shell uname),Linux)
|
ifeq ($(shell uname),Linux)
|
||||||
LDFLAGS += -static-libgcc
|
LDFLAGS += -nostdlib++
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
LDFLAGS += -Wl,--subsystem,windows -mwindows
|
LDFLAGS += -Wl,--subsystem,windows -mwindows
|
||||||
|
|||||||
@ -41,8 +41,8 @@ inline constexpr mat<4, 4, T> rotate_x(T t)
|
|||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
1, 0, 0, 0,
|
1, 0, 0, 0,
|
||||||
0, cos(t), -sin(t), 0,
|
0, cosf(t), -sinf(t), 0,
|
||||||
0, sin(t), cos(t), 0,
|
0, sinf(t), cosf(t), 0,
|
||||||
0, 0, 0, 1
|
0, 0, 0, 1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -51,9 +51,9 @@ template <typename T>
|
|||||||
inline constexpr mat<4, 4, T> rotate_y(T t)
|
inline constexpr mat<4, 4, T> rotate_y(T t)
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
cos(t), 0, sin(t), 0,
|
cosf(t), 0, sinf(t), 0,
|
||||||
0, 1, 0, 0,
|
0, 1, 0, 0,
|
||||||
-sin(t), 0, cos(t), 0,
|
-sinf(t), 0, cosf(t), 0,
|
||||||
0, 0, 0, 1
|
0, 0, 0, 1
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -62,8 +62,8 @@ template <typename T>
|
|||||||
inline constexpr mat<4, 4, T> rotate_z(T t)
|
inline constexpr mat<4, 4, T> rotate_z(T t)
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
cos(t), -sin(t), 0, 0,
|
cosf(t), -sinf(t), 0, 0,
|
||||||
sin(t), cos(t), 0, 0,
|
sinf(t), cosf(t), 0, 0,
|
||||||
0, 0, 1, 0,
|
0, 0, 1, 0,
|
||||||
0, 0, 0, 1
|
0, 0, 0, 1
|
||||||
};
|
};
|
||||||
@ -149,7 +149,7 @@ template <typename T>
|
|||||||
inline constexpr T inverse_length(vec<3, T> v)
|
inline constexpr T inverse_length(vec<3, T> v)
|
||||||
{
|
{
|
||||||
float f = dot(v, v);
|
float f = dot(v, v);
|
||||||
return 1.0f / sqrt<T>(f);
|
return 1.0f / sqrtf(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
12
src/main.c
12
src/main.c
@ -2,6 +2,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "glad/gl.h"
|
#include "glad/gl.h"
|
||||||
|
|
||||||
@ -81,8 +82,8 @@ int main()
|
|||||||
#endif
|
#endif
|
||||||
glfwInit();
|
glfwInit();
|
||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);
|
||||||
|
|
||||||
GLFWwindow* window = glfwCreateWindow(vp_width, vp_height, "new", NULL, NULL);
|
GLFWwindow* window = glfwCreateWindow(vp_width, vp_height, "new", NULL, NULL);
|
||||||
@ -106,6 +107,11 @@ int main()
|
|||||||
GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
|
GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));
|
||||||
return -1;
|
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
|
// meshes
|
||||||
@ -173,6 +179,8 @@ int main()
|
|||||||
const double first_frame = glfwGetTime();
|
const double first_frame = glfwGetTime();
|
||||||
double last_frame = first_frame;
|
double last_frame = first_frame;
|
||||||
|
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window)) {
|
while (!glfwWindowShouldClose(window)) {
|
||||||
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
||||||
glfwSetWindowShouldClose(window, true);
|
glfwSetWindowShouldClose(window, true);
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#version 130
|
#version 130
|
||||||
|
|
||||||
|
precision highp float;
|
||||||
|
|
||||||
uniform sampler2D texture0;
|
uniform sampler2D texture0;
|
||||||
|
|
||||||
in vec2 f_texture;
|
in vec2 f_texture;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user