diff --git a/.gitignore b/.gitignore index ec2338f..e5ad81e 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ build # Compiled Static libraries *.lai *.la -*.a +# *.a # Executables *.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 528b65a..5d391bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,13 +16,13 @@ pybind11_add_module(${PROJECT_NAME} ${SRC}) target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/include) target_link_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/libs) -target_link_libraries(${PROJECT_NAME} PRIVATE glew32.lib) +target_link_libraries(${PROJECT_NAME} PRIVATE glew) add_subdirectory( ${PROJECT_SOURCE_DIR}/glfw ) target_link_libraries(${PROJECT_NAME} PRIVATE glfw) find_package(OpenGl REQUIRED) -target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL ) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL) diff --git a/include/glpy.h b/include/glpy.h index 5cd15bb..ba0f99d 100644 --- a/include/glpy.h +++ b/include/glpy.h @@ -1,5 +1,9 @@ #pragma once +#include +#include +namespace py = pybind11; namespace tests{ int glfw_window(unsigned width,unsigned height, std::string title); + int glfw_black_window(unsigned width,unsigned height,std::string title); } \ No newline at end of file diff --git a/libs/glew32.lib b/libs/glew32.lib deleted file mode 100644 index 3d780d9..0000000 Binary files a/libs/glew32.lib and /dev/null differ diff --git a/libs/glew32s.lib b/libs/glew32s.lib deleted file mode 100644 index 584c462..0000000 Binary files a/libs/glew32s.lib and /dev/null differ diff --git a/libs/libglew-shared.dll.a b/libs/libglew-shared.dll.a new file mode 100644 index 0000000..a7f676c Binary files /dev/null and b/libs/libglew-shared.dll.a differ diff --git a/libs/libglew.a b/libs/libglew.a new file mode 100644 index 0000000..5f2f307 Binary files /dev/null and b/libs/libglew.a differ diff --git a/src/glfw_black_window.cpp b/src/glfw_black_window.cpp new file mode 100644 index 0000000..8bb2479 --- /dev/null +++ b/src/glfw_black_window.cpp @@ -0,0 +1,67 @@ +#include +#include +// #include +#include +#include + +int tests::glfw_black_window(unsigned width,unsigned height,std::string title) +{ + GLFWwindow* window; + + /* Initialize the library */ + if (!glfwInit()) + return -1; + + /* Create a windowed mode window and its OpenGL context */ + window = glfwCreateWindow(width, height, title.c_str(), NULL, NULL); + if (!window) + { + glfwTerminate(); + return -1; + } + + /* Make the window's context current */ + glfwMakeContextCurrent(window); + + std::cout<<"-- OPEN_GL_VERSION: "< -#include #include - -namespace py = pybind11; - - PYBIND11_MODULE(glpy, m) { m.doc() = "glpy a python opengl project"; // optional module docstring auto tests = m.def_submodule("tests","the tests module"); - - tests.def("glfw_window",&tests::glfw_window, + + tests.def("glfw_black_window",&tests::glfw_black_window, py::arg("width"), py::arg("height"), py::arg("title") - ); + ); + + // tests.def("glfw_window",&tests::glfw_window, + // py::arg("width"), + // py::arg("height"), + // py::arg("title") + // ); } \ No newline at end of file diff --git a/src/test_window.cpp b/src/test_window.cpp index 69fa79e..610072e 100644 --- a/src/test_window.cpp +++ b/src/test_window.cpp @@ -1,8 +1,8 @@ -#include +#include #include #include #include -#include + static int CreateShader(const std::string& vertexShader, const std::string& fragmentShader){ unsigned int program = glCreateProgram(); @@ -17,8 +17,6 @@ int tests::glfw_window(unsigned width,unsigned height, std::string title) if (!glfwInit()) return -1; - - /* Create a windowed mode window and its OpenGL context */ window = glfwCreateWindow(width, height, title.c_str(), NULL, NULL); if (!window)