Coder Social home page Coder Social logo

weigert / tinyengine Goto Github PK

View Code? Open in Web Editor NEW
962.0 23.0 62.0 81.63 MB

Tiny OpenGL Wrapper / 3D Engine in C++

C++ 86.29% C 13.18% Makefile 0.19% Python 0.31% GLSL 0.02%
engine3d engine opengl3 3d-engine tinyengine shaders drawing wrapper drawing-helper audio

tinyengine's Issues

compile error on iMac with chip M1

I am sorry for this, but maybe because I just moving to a new iMac with chip M1, after setup all the commands, I still have this error:

apple@Apples-iMac TinyEngine % brew install glew
Warning: glew 2.2.0_1 is already installed and up-to-date.
To reinstall 2.2.0_1, run:
  brew reinstall glew
apple@Apples-iMac TinyEngine % sudo make all     
Password:
Copying Core Header Files ...
Done
Copying Helper Header Files ...
Done
Compiling TinyEngine ...
In file included from TinyEngine.cpp:3:
./TinyEngine.h:9:10: fatal error: 'GL/glew.h' file not found
#include <GL/glew.h>                                //Rendering Dependencies
         ^~~~~~~~~~~
1 error generated.
make: *** [install] Error 1

Examples won't start

Hello,

Get the error

$ cd examples/9_Scene
$ make all
g++ -std=c++17 main.cpp -Wfatal-errors -O -I/usr/local/include -L/usr/local/lib -lTinyEngine -lX11 -lGL -lpthread -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGLEW -lboost_system -lboost_filesystem -o main
$ ./main
Window could not be created! SDL_Error: Couldn't find matching GLX visual
Failed to launch visual interface.
Adres-eraro(nekropsio elŝutita) = "Segmentation fault" in esperanto

and

$ export SDL_VIDEO_X11_VISUALID=0x179
$ ./main
Adres-eraro(nekropsio elŝutita) = "Segmentation fault" in esperanto

for all examples on Fedora and Win11/WSL/Ubunutu Jammy. It seems something with the gui-system, I use wayland.

Greets and thanks for this program!

iOS Support

Hi!

Could you please tell me if iOS support is planned?

Thank you!

Examples wont compile (except the empty example)

Hi, I wanted to test the engine so I tried to compile the examples and they won't because of the lambdas you are using, here is the image example when I try and compile it using g++ in manjaro (I'm pretty new to the Linux environment)

In file included from main.cpp:5: effects.h:9:25: error: non-local lambda expression cannot have a capture-default 9 | Handle interfaceFunc = [&](){ | ^ compilation terminated due to -Wfatal-errors.

Keep getting segmentation error

Hey, I'm trying to use TinyEngine for a project because it looks really cool and useful, but I keep getting segmentation errors in when running the examples. Am I doing something wrong? Reading through the code it all seems like it should work.

I'm on MacOS.

For example, with the Heightmap example, I get a EXC_BAD_ACCESS (code=1, address=0x0) error due to this line:
mesh.bind<glm::vec3>("in_Position", &positions); //Bind Buffer to Property

Another example, when initiating a cube, I get pointed to the same error in the model helper. There seems to be something wrong in this line in void bind:
glBindVertexBuffer(bindings[binding], buf->index, 0, sizeof(T));

Do you know why this could be? Am I doing something wrong?

TinyEngine/timer missing

Hi, Tried to compile TinyEngine on Ubuntu 20.04 and got this error

$ make all -j8
Copying Core Header Files ...
Copying Helper Header Files ...
Compiling TinyEngine ...
Done
Done
In file included from TinyEngine.cpp:3:
TinyEngine.h:36:10: fatal error: TinyEngine/timer: No such file or directory
   36 | #include <TinyEngine/timer>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [makefile:48: install] Error 1

I have modified the make file to install it in my $HOME since I don't want to spew files all over my file system. I have changed LIBPATH and INCLUDEPATH and changed line 23 to

@if [ ! -d "$(INCLUDEPATH)/TinyEngine" ]; then mkdir -p $(INCLUDEPATH)/TinyEngine; fi;

and line 65 to

@if [ ! -d "$(INCLUDEPATH)/TinyEngine" ]; then mkdir -p $(INCLUDEPATH)/TinyEngine; fi;

I don't think this is relevant since this error showed up when I tried to install with sudo without modifying the make file.

Switch from /usr/local/ to ~/.local

A bit unusual that the project requires root priveleges. Usually projects will build relative to the source tree in cwd. An install is a seperate step to perform once any vetting / audit is complete.
The easiest way to avoid the sudo might be to switch target from /usr/local to $HOME/.local - at least on relatively modern linux.
the files to modify would be

$ grep -rl "/usr/local" *
examples/7.0_SDF/makefile
examples/13.0_Dither/makefile
examples/11.0_Voronoi/makefile
examples/19.1_LBM3D/makefile
examples/18.0_SphereVoronoi/makefile
examples/17.0_ODE3D/makefile
examples/8.0_Raymarch/makefile
examples/19.3_LBM3D/makefile
examples/4.0_Julia/makefile
examples/3.0_Automata/makefile
examples/0.0_Empty/makefile
examples/2.0_Heightmap/makefile
examples/1.0_Image/makefile
examples/.SlimeMold/makefile
examples/19.2_CollidingBalls/makefile
examples/5.0_Particles/makefile
examples/9.0_Scene/makefile
examples/10.0_Audio/makefile
examples/21.1_Delaunay_Divide/makefile
examples/12.0_Diffusion/makefile
examples/16.0_Gravity/makefile
examples/14.0_Renderpool/makefile
examples/0.1_Windowless/makefile
examples/21.0_Delaunay/makefile
examples/19.0_LBM2D/makefile
examples/20.0_Cloth/makefile
examples/15.0_Compute/makefile
examples/6.0_Tree/makefile
Makefile
python/setup_torch.py
python/setup.py
README.md

To change install target I ran:

find . -iname makefile -exec sed -i 's/\/usr\/local/\~\/.local/g' {} \;

To avoid errors caused by already-existing directories from previous run, i added "-p" to the mkdir

find . -iname makefile -exec sed -i 's/mkdir/mkdir \-p/g' {} \;

Then um, something something the linker needs to get pointed to ~/.local/lib without requiring overwriting of /etc/ld.so.cache

Not sure what the right way to do that is, sorry.
Maybe something like changing the link invocation

/TinyEngine/examples/0.0_Empty$ g++ -std=c++17 main.cpp -Wfatal-errors -O -I~/.local/include -L~/.local/lib/TinyEngine -lpthread -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGLEW -lboost_system -lboost_filesystem -lX11 -lGL -o main

Cheers. Great project here.

How to build and run examples on MacOS

hi @weigert
I am trying to make this awesome Engine works on macOS. I just download all required libraries and can run build all

I modify the makefile of each example to work in macOS like bellow

TINYLINK = -lpthread -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -framework OpenGL -lGLEW -lboost_system -lboost_filesystem

(Remove -lX11 and replace -lGL with -framework OpenGL)

Then I can compile and run example 1
With example 2, I have this error:

4.1 ATI-4.5.14
Linker Error: ERROR: 0:1: '' :  version '130' is not supported
ERROR: 0:2: '' :  #version required and missing.

Linker Error: ERROR: 0:1: '' :  version '130' is not supported
ERROR: 0:2: '' :  #version required and missing.


image

If you want I can create PR after all examples run on MacOS! Thank you in advance!

Errors while trying to build (Linux Manjaro)

Linux 5.6.16-1-MANJARO x86_64 20.0.3 Lysia

GCC version 10.1.0

~/.../examples/5_Particles >>> make -f makefile ±[master]
g++ -std=c++17 main.cpp ../../include/imgui/imgui.cpp ../../include/imgui/imgui_demo.cpp ../../include/imgui/imgui_draw.cpp ../../include/imgui/imgui_widgets.cpp ../../include/imgui/imgui_impl_opengl3.cpp ../../include/imgui/imgui_impl_sdl.cpp -Wfatal-errors -O -I/usr/local/include -L/usr/local/lib -lX11 -lpthread -lSDL2 -lnoise -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGL -lGLEW -lboost_serialization -lboost_system -lboost_filesystem -o main
In file included from main.cpp:1:
../../TinyEngine.h:4:42: ошибка: «string» не является элементом «std»
4 | using slist = std::initializer_liststd::string;
| ^~~~~~
компиляция прервана из-за -Wfatal-errors.
make: *** [makefile:13: all] Ошибка 1

1) add #include <string> to TinyEngine.h

~/.../examples/5_Particles >>> make -f makefile ±[master]
g++ -std=c++17 main.cpp ../../include/imgui/imgui.cpp ../../include/imgui/imgui_demo.cpp ../../include/imgui/imgui_draw.cpp ../../include/imgui/imgui_widgets.cpp ../../include/imgui/imgui_impl_opengl3.cpp ../../include/imgui/imgui_impl_sdl.cpp -Wfatal-errors -O -I/usr/local/include -L/usr/local/lib -lX11 -lpthread -lSDL2 -lnoise -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGL -lGLEW -lboost_serialization -lboost_system -lboost_filesystem -o main
In file included from ../../TinyEngine.h:33,
from main.cpp:1:
../../include/event.cpp:23:8: ошибка: «deque» в пространстве имен «std» не именует тип шаблона
23 | std::deque<SDL_Keycode> press;
| ^~~~~
компиляция прервана из-за -Wfatal-errors.
make: *** [makefile:13: all] Ошибка 1

2) add #include <deque> to event.cpp

~/.../examples/5_Particles >>> make -f makefile ±[●][master]
g++ -std=c++17 main.cpp ../../include/imgui/imgui.cpp ../../include/imgui/imgui_demo.cpp ../../include/imgui/imgui_draw.cpp ../../include/imgui/imgui_widgets.cpp ../../include/imgui/imgui_impl_opengl3.cpp ../../include/imgui/imgui_impl_sdl.cpp -Wfatal-errors -O -I/usr/local/include -L/usr/local/lib -lX11 -lpthread -lSDL2 -lnoise -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGL -lGLEW -lboost_serialization -lboost_system -lboost_filesystem -o main
In file included from main.cpp:5:
model.h:16:39: ошибка: non-local lambda expression cannot have a capture-default
16 | std::function<void()> eventHandler = &{
| ^
компиляция прервана из-за -Wfatal-errors.
make: *** [makefile:13: all] Ошибка 1

3) after rewrite main.cpp

~/.../examples/5_Particles >>> make -f makefile ±[●][master]
g++ -std=c++17 main.cpp ../../include/imgui/imgui.cpp ../../include/imgui/imgui_demo.cpp ../../include/imgui/imgui_draw.cpp ../../include/imgui/imgui_widgets.cpp ../../include/imgui/imgui_impl_opengl3.cpp ../../include/imgui/imgui_impl_sdl.cpp -Wfatal-errors -O -I/usr/local/include -L/usr/local/lib -lX11 -lpthread -lSDL2 -lnoise -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGL -lGLEW -lboost_serialization -lboost_system -lboost_filesystem -o main
/usr/bin/ld: невозможно найти -lnoise
collect2: ошибка: выполнение ld завершилось с кодом возврата 1
make: *** [makefile:13: all] Ошибка 1

4) remove -lnoise from makefile

Success

Build on MSYS2 MINGW64

Your Makefile works out of the box. You only have to create ~/.local directory before running make.

There is an warning I think I should report back to you:

include/imgui/imgui_draw.cpp: In function 'void ImFontAtlasBuildPackCustomRects(ImFontAtlas*, void*)':
include/imgui/imgui_draw.cpp:2214:11: warning: 'void* memset(void*, int, size_t)' specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
 2214 |     memset(pack_rects.Data, 0, (size_t)pack_rects.size_in_bytes());
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

noise.h missing for heightmap example

Trying to compile 2_Heightmap yields

g++ -std=c++17 main.cpp ../../include/imgui/imgui.cpp ../../include/imgui/imgui_demo.cpp ../../include/imgui/imgui_draw.cpp ../../include/imgui/imgui_widgets.cpp ../../include/imgui/imgui_impl_opengl3.cpp ../../include/imgui/imgui_impl_sdl.cpp -Wfatal-errors -O -I/usr/local/include -L/usr/local/lib -lX11 -lpthread -lSDL2 -lnoise -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lGL -lGLEW -lboost_serialization -lboost_system -lboost_filesystem -o main
In file included from main.cpp:4:0:
model.h:1:10: fatal error: noise/noise.h: No such file or directory
#include "noise/noise.h"
^~~~~~~~~~~~~~~
compilation terminated.

(and as someone mentioned in another issue, -lnoise has to be removed from 5_Particles makefile)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.