Compare commits
No commits in common. "d3506737f0a01a5b50af50e80941c98673a47f60" and "4ce0f0d2f4c033a03748aef824fb12490cc1a409" have entirely different histories.
d3506737f0
...
4ce0f0d2f4
|
@ -3,8 +3,7 @@ cmake_minimum_required(VERSION 3.21)
|
||||||
project(Exponent CXX)
|
project(Exponent CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined -g")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined")
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
|
||||||
|
|
||||||
add_subdirectory(glfw)
|
add_subdirectory(glfw)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
2
glfw
2
glfw
|
@ -1 +1 @@
|
||||||
Subproject commit 7b6aead9fb88b3623e3b3725ebb42670cbe4c579
|
Subproject commit 228e58262e18f2ee61799bd86d0be718b1e31f9f
|
|
@ -9,7 +9,6 @@ add_executable(Exponent
|
||||||
target_link_libraries(Exponent PUBLIC glfw glm::glm)
|
target_link_libraries(Exponent PUBLIC glfw glm::glm)
|
||||||
target_include_directories(Exponent PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
target_include_directories(Exponent PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
||||||
|
|
||||||
target_compile_definitions(Exponent PUBLIC "$<$<CONFIG:DEBUG>:DEBUG>")
|
|
||||||
target_compile_definitions(Exponent PRIVATE GLFW_INCLUDE_NONE)
|
target_compile_definitions(Exponent PRIVATE GLFW_INCLUDE_NONE)
|
||||||
|
|
||||||
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/shaders/shader.frag" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
|
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/shaders/shader.frag" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
|
||||||
|
|
|
@ -24,8 +24,6 @@ static GLuint compile_shader(GLenum shader_type, const std::string &path) {
|
||||||
std::string shader_source_str = shader_source_stream.str();
|
std::string shader_source_str = shader_source_stream.str();
|
||||||
const GLchar *shader_source = shader_source_str.c_str();
|
const GLchar *shader_source = shader_source_str.c_str();
|
||||||
|
|
||||||
shader_file_handle.close();
|
|
||||||
|
|
||||||
GLuint shader_id = glCreateShader(shader_type);
|
GLuint shader_id = glCreateShader(shader_type);
|
||||||
|
|
||||||
if (shader_id == 0) {
|
if (shader_id == 0) {
|
||||||
|
@ -79,9 +77,5 @@ GLuint compile_and_link_program(const std::vector<std::pair<GLuint, std::string>
|
||||||
throw GLProgramException(std::format("Program {} link failed:\n{}", program_id, error_log));
|
throw GLProgramException(std::format("Program {} link failed:\n{}", program_id, error_log));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &s:shader_ids) {
|
|
||||||
glDeleteShader(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
return program_id;
|
return program_id;
|
||||||
}
|
}
|
|
@ -19,5 +19,4 @@ Mesh::Mesh(std::span<glm::vec2> verts) {
|
||||||
|
|
||||||
Mesh::~Mesh() {
|
Mesh::~Mesh() {
|
||||||
glDeleteVertexArrays(1, &vao);
|
glDeleteVertexArrays(1, &vao);
|
||||||
glDeleteBuffers(1, &vbo);
|
|
||||||
}
|
}
|
||||||
|
|
13
src/main.cc
13
src/main.cc
|
@ -90,6 +90,8 @@ static GLuint vertex_buf[2];
|
||||||
static GLuint array_buf[2];
|
static GLuint array_buf[2];
|
||||||
static const GLuint vertex_data_position = 0;
|
static const GLuint vertex_data_position = 0;
|
||||||
|
|
||||||
|
static Quad *o1;
|
||||||
|
|
||||||
static std::vector<Quad *> quads = {};
|
static std::vector<Quad *> quads = {};
|
||||||
|
|
||||||
static std::array<glm::vec2, 6> verts({
|
static std::array<glm::vec2, 6> verts({
|
||||||
|
@ -119,8 +121,8 @@ static void init_opengl() {
|
||||||
dbg_log("Initialising opengl");
|
dbg_log("Initialising opengl");
|
||||||
|
|
||||||
// During init, enable debug output
|
// During init, enable debug output
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
glEnable ( GL_DEBUG_OUTPUT );
|
||||||
glDebugMessageCallback(MessageCallback, 0);
|
glDebugMessageCallback( MessageCallback, 0 );
|
||||||
|
|
||||||
// Configure the context's capabilities
|
// Configure the context's capabilities
|
||||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||||
|
@ -170,13 +172,8 @@ int main() {
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto q: quads) {
|
delete(o1);
|
||||||
delete(q);
|
|
||||||
}
|
|
||||||
|
|
||||||
glfwDestroyWindow(w);
|
glfwDestroyWindow(w);
|
||||||
#ifndef DEBUG
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
#endif
|
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue