mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
break apart into modules; add vendor dependencies; add OpenGL boilerplate to get started
This commit is contained in:
10
.gitmodules
vendored
Normal file
10
.gitmodules
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[submodule "vendor/glfw"]
|
||||||
|
path = vendor/glfw
|
||||||
|
url = https://github.com/glfw/glfw.git
|
||||||
|
[submodule "vendor/glad"]
|
||||||
|
path = vendor/glad
|
||||||
|
url = https://github.com/Dav1dde/glad.git
|
||||||
|
branch = c
|
||||||
|
[submodule "vendor/glm"]
|
||||||
|
path = vendor/glm
|
||||||
|
url = https://github.com/g-truc/glm.git
|
||||||
@@ -3,7 +3,17 @@ project(toddcox-faster)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
add_library(tc STATIC src/groups.cpp src/solver.cpp src/cosets.cpp)
|
add_library(glad vendor/glad/src/glad.c)
|
||||||
target_include_directories(tc PUBLIC include)
|
target_include_directories(glad PUBLIC vendor/glad/include)
|
||||||
|
|
||||||
|
option(GLFW_BUILD_DOCS OFF)
|
||||||
|
option(GLFW_BUILD_EXAMPLES OFF)
|
||||||
|
option(GLFW_BUILD_TESTS OFF)
|
||||||
|
add_subdirectory(vendor/glfw)
|
||||||
|
|
||||||
|
option(GLM_TEST_ENABLE OFF)
|
||||||
|
add_subdirectory(vendor/glm)
|
||||||
|
|
||||||
|
add_subdirectory(tc)
|
||||||
|
add_subdirectory(vis)
|
||||||
add_subdirectory(example)
|
add_subdirectory(example)
|
||||||
|
|||||||
6
tc/CMakeLists.txt
Normal file
6
tc/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
add_library(tc STATIC
|
||||||
|
src/groups.cpp
|
||||||
|
src/solver.cpp
|
||||||
|
src/cosets.cpp)
|
||||||
|
|
||||||
|
target_include_directories(tc PUBLIC include)
|
||||||
1
vendor/glad
vendored
Submodule
1
vendor/glad
vendored
Submodule
Submodule vendor/glad added at 5bf3eda6da
1
vendor/glfw
vendored
Submodule
1
vendor/glfw
vendored
Submodule
Submodule vendor/glfw added at fe57e3c292
1
vendor/glm
vendored
Submodule
1
vendor/glm
vendored
Submodule
Submodule vendor/glm added at 8828c3f1fd
4
vis/CMakeLists.txt
Normal file
4
vis/CMakeLists.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
add_executable(vis
|
||||||
|
src/main.cpp)
|
||||||
|
target_include_directories(vis PRIVATE include)
|
||||||
|
target_link_libraries(vis PRIVATE tc glad glm glfw)
|
||||||
58
vis/src/main.cpp
Normal file
58
vis/src/main.cpp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
#include <glad/glad.h>
|
||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <tc/groups.h>
|
||||||
|
#include <tc/solver.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
extern "C" {
|
||||||
|
__attribute__((unused)) __declspec(dllexport) int NvOptimusEnablement = 0x00000001;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
if (!glfwInit()) {
|
||||||
|
std::cerr << "Failed to initialize GLFW" << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto window = glfwCreateWindow(
|
||||||
|
1920, 1080,
|
||||||
|
"Coset Visualization",
|
||||||
|
nullptr, nullptr);
|
||||||
|
|
||||||
|
if (!window) {
|
||||||
|
std::cerr << "Failed to create window" << std::endl;
|
||||||
|
glfwTerminate();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwMakeContextCurrent(window);
|
||||||
|
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
|
glfwSwapInterval(0);
|
||||||
|
|
||||||
|
std::cout
|
||||||
|
<< "Graphics Information:" << std::endl
|
||||||
|
<< " Vendor: " << glGetString(GL_VENDOR) << std::endl
|
||||||
|
<< " Renderer: " << glGetString(GL_RENDERER) << std::endl
|
||||||
|
<< " OpenGL version: " << glGetString(GL_VERSION) << std::endl
|
||||||
|
<< " Shading version: " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||||
|
|
||||||
|
auto group = tc::group::A(5);
|
||||||
|
auto res = tc::solve(group);
|
||||||
|
std::cout
|
||||||
|
<< "Coset Solution Test:" << std::endl
|
||||||
|
<< " Group: " << group.name << std::endl
|
||||||
|
<< " Order: " << res.len << std::endl;
|
||||||
|
|
||||||
|
while (!glfwWindowShouldClose(window)) {
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
glfwSwapBuffers(window);
|
||||||
|
|
||||||
|
glfwPollEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
glfwTerminate();
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user