Compare commits

..

No commits in common. "d3506737f0a01a5b50af50e80941c98673a47f60" and "4ce0f0d2f4c033a03748aef824fb12490cc1a409" have entirely different histories.

6 changed files with 8 additions and 20 deletions

View File

@ -3,8 +3,7 @@ cmake_minimum_required(VERSION 3.21)
project(Exponent CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined -g")
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined")
add_subdirectory(glfw)
add_subdirectory(src)

2
glfw

@ -1 +1 @@
Subproject commit 7b6aead9fb88b3623e3b3725ebb42670cbe4c579
Subproject commit 228e58262e18f2ee61799bd86d0be718b1e31f9f

View File

@ -9,7 +9,6 @@ add_executable(Exponent
target_link_libraries(Exponent PUBLIC glfw glm::glm)
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)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/shaders/shader.frag" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/shaders/")

View File

@ -24,8 +24,6 @@ static GLuint compile_shader(GLenum shader_type, const std::string &path) {
std::string shader_source_str = shader_source_stream.str();
const GLchar *shader_source = shader_source_str.c_str();
shader_file_handle.close();
GLuint shader_id = glCreateShader(shader_type);
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));
}
for (auto &s:shader_ids) {
glDeleteShader(s);
}
return program_id;
}
}

View File

@ -19,5 +19,4 @@ Mesh::Mesh(std::span<glm::vec2> verts) {
Mesh::~Mesh() {
glDeleteVertexArrays(1, &vao);
glDeleteBuffers(1, &vbo);
}

View File

@ -90,6 +90,8 @@ static GLuint vertex_buf[2];
static GLuint array_buf[2];
static const GLuint vertex_data_position = 0;
static Quad *o1;
static std::vector<Quad *> quads = {};
static std::array<glm::vec2, 6> verts({
@ -119,8 +121,8 @@ static void init_opengl() {
dbg_log("Initialising opengl");
// During init, enable debug output
glEnable(GL_DEBUG_OUTPUT);
glDebugMessageCallback(MessageCallback, 0);
glEnable ( GL_DEBUG_OUTPUT );
glDebugMessageCallback( MessageCallback, 0 );
// Configure the context's capabilities
glClearColor(0.0, 0.0, 0.0, 1.0);
@ -170,13 +172,8 @@ int main() {
glfwPollEvents();
}
for(auto q: quads) {
delete(q);
}
delete(o1);
glfwDestroyWindow(w);
#ifndef DEBUG
glfwTerminate();
#endif
exit(EXIT_SUCCESS);
}