Compare commits

...

6 Commits

Author SHA1 Message Date
69dbe5ae2f feat: building on windows instructions 2025-10-01 10:41:38 +02:00
de6496ff81 feat: no glew static on windows 2025-10-01 10:41:29 +02:00
807e0ce9d9 feat: accept filesystem path 2025-10-01 10:41:24 +02:00
58e25b530b feat: explicit include of cmath with defines 2025-10-01 10:41:13 +02:00
39f528d7ad feat: dynamic glew linking on windows 2025-10-01 10:40:59 +02:00
6dc269ce13 feat: accept filepath 2025-10-01 10:40:50 +02:00
6 changed files with 29 additions and 2 deletions

View File

@ -4,6 +4,20 @@
This is a basic future game engine for OpenGL 3D rendered games This is a basic future game engine for OpenGL 3D rendered games
## Building on Windows
In order to configure and run project on windows platform use following commands.
Configuring:
```console
cmake -S . -B build `
-G "Visual Studio 17 2022" -A x64 `
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DCMAKE_BUILD_TYPE=Debug
```
## Multi-GPU Devices ## Multi-GPU Devices
If you want to use non-primary GPU on your device when launching the game specifically on Linux you should specify additional environment variables before running. For example in my case I have a hybrid gaming laptop with 2 GPUs AMD from CPU and NVIDIA discrete. If you want to use non-primary GPU on your device when launching the game specifically on Linux you should specify additional environment variables before running. For example in my case I have a hybrid gaming laptop with 2 GPUs AMD from CPU and NVIDIA discrete.

View File

@ -2,6 +2,7 @@
#define MODEL_H_ #define MODEL_H_
#include <vector> #include <vector>
#include <string> #include <string>
#include <filesystem>
#include <unordered_map> #include <unordered_map>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <memory> #include <memory>
@ -120,7 +121,7 @@ public:
static Object LoadFile(const std::string& filename); static Object LoadFile(const std::string& filename);
private: private:
void LoadMaterials(const std::string& filename); void LoadMaterials(const std::filesystem::path& filename);
private: private:
void AddMaterial(std::string name, std::shared_ptr<Material> material); void AddMaterial(std::string name, std::shared_ptr<Material> material);
std::shared_ptr<Material> GetMaterial(std::string name); std::shared_ptr<Material> GetMaterial(std::string name);

View File

@ -1,7 +1,11 @@
#ifndef PRELUDE_H_ #ifndef PRELUDE_H_
#define PRELUDE_H_ #define PRELUDE_H_
#ifndef WIN32
#define GLEW_STATIC #define GLEW_STATIC
#endif
#include <GL/glew.h> #include <GL/glew.h>
#include "SDL3/SDL.h" #include "SDL3/SDL.h"
struct RenderContext { struct RenderContext {

View File

@ -1,4 +1,10 @@
#include <iostream> #include <iostream>
// #ifdef WIN32
#define _USE_MATH_DEFINES
#include <cmath>
// #endif
#include <vector> #include <vector>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/ext/quaternion_geometric.hpp> #include <glm/ext/quaternion_geometric.hpp>

View File

@ -86,7 +86,7 @@ Object::Object() {
m_texCoords = std::vector<glm::vec2>(); m_texCoords = std::vector<glm::vec2>();
} }
void Object::LoadMaterials(const std::string& filename) { void Object::LoadMaterials(const std::filesystem::path& filename) {
std::ifstream file(filename); std::ifstream file(filename);
std::string currentMaterialName; std::string currentMaterialName;

View File

@ -6,7 +6,9 @@
#include <errno.h> #include <errno.h>
#include "prelude.h" #include "prelude.h"
#ifndef WIN32
#define GLEW_STATIC #define GLEW_STATIC
#endif
#include <GL/glew.h> #include <GL/glew.h>
#define SCREEN_WIDTH 1024 #define SCREEN_WIDTH 1024