diff --git a/CMakeLists.txt b/CMakeLists.txt index af9ebf99df4e819b024e6505b28f179b3b37978a..deb1a82691820d002ef68e18dcfef42d5f54f630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") TLS_VERIFY ON) endif() +include(${CMAKE_BINARY_DIR}/conan_paths.cmake) include(${CMAKE_BINARY_DIR}/conan.cmake) conan_cmake_run(CONANFILE conanfile.txt # or relative build/conanfile.txt BASIC_SETUP CMAKE_TARGETS diff --git a/conanfile.txt b/conanfile.txt index 90e6e04152622c4ab99e958cbdb1b13a2429960c..20cf10f04e5b28225735a53698e7861c5bcf0b07 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -6,9 +6,10 @@ glm/0.9.9.8 spdlog/1.10.0 [generators] -CMakeDeps -CMakeToolchain +cmake_find_package +cmake_paths [options] glad:gl_profile=core -glad:gl_version=4.5 \ No newline at end of file +glad:gl_version=4.5 +glad:extensions="GL_ARB_get_program_binary" \ No newline at end of file diff --git a/fggl/data/procedural.cpp b/fggl/data/procedural.cpp index a89ecbb97527f246c1c813046e8b91ce39a7c82c..ab4649bcaeb9d0c8145dc5a0fede7ca2d2ae7583 100644 --- a/fggl/data/procedural.cpp +++ b/fggl/data/procedural.cpp @@ -158,7 +158,8 @@ fggl::data::Mesh fggl::data::make_quad_xz() { constexpr float HALF_PI = M_PI / 2.0F; static void populateMesh(fggl::data::Mesh& mesh, const fggl::math::mat4 transform, const int nIdx, const fggl::math::vec3* pos, const int* idx ) { - int colIdx[nIdx]; + + int* colIdx = new int[nIdx]; // generate mesh for (int i=0; i<nIdx; i++) { @@ -173,6 +174,8 @@ static void populateMesh(fggl::data::Mesh& mesh, const fggl::math::mat4 transfor } computeNormalsDirect( mesh, colIdx, nIdx ); + + delete[] colIdx; } diff --git a/fggl/gfx/ogl/CMakeLists.txt b/fggl/gfx/ogl/CMakeLists.txt index f065ca1684e56328e5a4b0dba2a2ac9b8dc714c0..37b3290ccfd3fdf85746602d3fc038501509e5f1 100644 --- a/fggl/gfx/ogl/CMakeLists.txt +++ b/fggl/gfx/ogl/CMakeLists.txt @@ -8,19 +8,19 @@ target_sources(fggl types.cpp ) +# Math +# probably shouldn't be graphics dependent... +find_package( glm REQUIRED ) +target_link_libraries(${PROJECT_NAME} PUBLIC glm::glm) + # OpenGL Backend find_package( OpenGL REQUIRED ) include_directories( ${OPENGL_INCLUDE_DIR} ) -target_link_libraries(fggl PUBLIC opengl::opengl) +target_link_libraries(${PROJECT_NAME} PUBLIC opengl::opengl) # GLEW find_package( glad ) -target_link_libraries(${PROJECT_NAME} PRIVATE glad::glad) - -# Math -# probably shouldn't be graphics dependent... -find_package( glm ) -target_link_libraries(${PROJECT_NAME} PRIVATE glm::glm) +target_link_libraries(${PROJECT_NAME} PUBLIC glad::glad) # FreeType #find_package(Freetype REQUIRED ) diff --git a/fggl/gfx/ogl/renderer.cpp b/fggl/gfx/ogl/renderer.cpp index 04c73fc0285aa124b7b335346ed60cf48b244c2e..fea729595b907ee814b66416a428775e41cb5fa2 100644 --- a/fggl/gfx/ogl/renderer.cpp +++ b/fggl/gfx/ogl/renderer.cpp @@ -145,7 +145,7 @@ namespace fggl::gfx { OpenGL4Backend::OpenGL4Backend(const Window &owner) : fggl::gfx::Graphics() { // initialise GLEW, or fail // FIXME this binds the graphics stack to GLFW :'( - int version = gladLoadGLLoader(glfwGetProcAddress); + int version = gladLoadGLLoader( (GLADloadproc)glfwGetProcAddress ); if (version == 0) { printf("Failed to initialize OpenGL context\n"); } diff --git a/fggl/gfx/ogl/shader.cpp b/fggl/gfx/ogl/shader.cpp index ec31c416887c5558c984ebd930c6b2c48bbae74b..63e69face5b108c876cac08643dc276414aa748c 100644 --- a/fggl/gfx/ogl/shader.cpp +++ b/fggl/gfx/ogl/shader.cpp @@ -1,4 +1,5 @@ +#include "fggl/gfx/ogl/types.hpp" #include <fggl/gfx/ogl/shader.hpp> #include <iostream> @@ -41,8 +42,8 @@ bool ShaderCache::compileShader(const std::string& fname, GLuint sid) { ShaderCache::ShaderCache(std::shared_ptr<fggl::data::Storage> storage) : m_storage(storage), m_shaders(), m_binary(true) { - if ( !GLEW_ARB_get_program_binary ) { - spdlog::warn("the graphics card doesn't support shader caching, disabling"); + if (GLAD_GL_ARB_get_program_binary) { + spdlog::warn("the graphics card doesn support shader caching, disabling"); m_binary = false; }