Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for wsl2 #48

Open
wants to merge 1 commit into
base: working
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ This will reduce the version to a compatibility version, reducing some features

Note that some examples rely on features introduced in OpenGL4+, meaning that the required version of GLSL will not be available. All example programs are reduced to the **minimum necessary version**.

To compile library for WSL you have to set the flag otherwise you probably will not able to use it. Compile library as follows:
```bash
export CPPFLAGS="-DTINYENGINE_COMPATIBILITY"
make all
```
#### Shipping Resources

TinyEngine supports the embedded shipping of resources in executables in a native way. It does this by utilizing [c-embed](https://github.com/weigert/c-embed) and desiging file-loading structures to use an `<stdio.h>` style interface. To ship your resources (i.e. shaders, images, .obj files) as embedded in the executable, use the `c-embed` style make rule as follows:
Expand Down Expand Up @@ -220,7 +225,7 @@ Currently TinyEngine has only been tested on linux (Ubuntu 18 LTS, Fedora 33) an
#### Debian-Based Systems (e.g. Ubuntu)

- OpenGL3: apt-get install libglu1-mesa-dev
- SDL2: apt-get install libsdl2-dev
- SDL2: apt-get install libsdl2-dev libsdl2-ttf-dev
- GLEW: apt-get install libglew-dev
- GLM: apt-get install libglm-dev

Expand All @@ -234,7 +239,7 @@ Currently TinyEngine has only been tested on linux (Ubuntu 18 LTS, Fedora 33) an
In a single command:

```bash
sudo apt-get install libglu1-mesa-dev libsdl2-dev libglew-dev libglm-dev
sudo apt-get install libglu1-mesa-dev libsdl2-dev libsdl2-ttf-dev libglew-dev libglm-dev
```

#### Fedora / DNF Package Manager Systems
Expand Down
4 changes: 2 additions & 2 deletions source/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LIBPATH = $(HOME)/.local/lib
INCPATH = $(HOME)/.local/include

# Compilation Settings
CC = g++ -std=c++17
CC = g++ -std=c++17 $(CPPFLAGS)
CF = -Wfatal-errors -O3

# MacOS: Dependencies install with homegrew
Expand All @@ -17,7 +17,7 @@ TINYOS = -lX11 -lGL
endif
ifeq ($(UNAME), Darwin) #Detext MacOS
INCPATH = /opt/homebrew/include
CC = g++-12 -std=c++17
CC = g++-12 -std=c++17 $(CPPFLAGS)
TINYOS = -framework OpenGL
endif

Expand Down
10 changes: 7 additions & 3 deletions source/TinyEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ bool init(){
printf( "SDL could not initialize! Error: %s\n", SDL_GetError() );
return false;
}

#ifndef TINYENGINE_COMPATIBILITY
std::cout << "SDL Init done\n";

#ifdef TINYENGINE_COMPATIBILITY
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
std::cout << "Comptibility mode ON\n";
#else
std::cout << "Comptibility mode OFF\n";
#endif

signal(SIGINT, &sighandler);
Expand Down