HackerPoet / NonEuclidean

A Non-Euclidean Rendering Engine for 3D scenes.
MIT License
6.1k stars 581 forks source link

Add support for SDL2 backend #32

Open Srinivasa314 opened 4 years ago

Srinivasa314 commented 4 years ago

CzechBlueBear/NonEuclidean adds support for SDL2 backend but unfortunately it is has a lot of bugs. This pull request will merge changes from his repo with the following changes

y4my4my4m commented 4 years ago

@Srinivasa314 this compiles and runs with no problems, however:

1) input delay / strange input behaviour

2) the window doesnt open on the main monitor but at 0,0 coordinate and cant really be readjusted

Srinivasa314 commented 4 years ago
  1. input delay / strange input behaviour

I am not entirely sure. This is what I think. The player continues to move for a while after input is stopped because it takes some time for friction to stop it. If you increase the friction value then the player stops immediately after input is stopped.

  1. the window doesnt open on the main monitor but at 0,0 coordinate and cant really be readjusted

Fixed it. Now window is centered.

y4my4my4m commented 4 years ago
  1. input delay / strange input behaviour

I am not entirely sure. This is what I think. The player continues to move for a while after input is stopped because it takes some time for friction to stop it. If you increase the friction value then the player stops immediately after input is stopped.

  1. the window doesnt open on the main monitor but at 0,0 coordinate and cant really be readjusted

Fixed it. Now window is centered.

Centering works great now!

Initial input has a good 9 seconds delay though, but if this doesn't happen on your end it may just be my environment.

hamdav commented 3 years ago

I found that compiling on mac I had to change the -lGL flag to -framework OpenGl. Even then though it compiled fine but I got segmentation fault when running it. Compiling on Arch linux worked fine, the only thing is that I could not move my mouse and walk at the same time.

Srinivasa314 commented 3 years ago

I found that compiling on mac I had to change the -lGL flag to -framework OpenGl

Fixed it

Even then though it compiled fine but I got segmentation fault when running it

I do not have a mac. Can you show the stacktrace?

Compiling on Arch linux worked fine, the only thing is that I could not move my mouse and walk at the same time.

I think it is because in some desktop environments you cannot use the keyboard and the mouse at the same time. If it is because of that then you can change that setting.

hamdav commented 3 years ago

No trace, just segmentation fault (core dumped) I think...

Srinivasa314 commented 3 years ago

You can use lldb or any other debugger to get the stack trace. Add -g to CXXFLAGS in the Makefile before compiling so that more information will be available to the debugger.

hamdav commented 3 years ago

It says

2021-03-14 19:16:24.091865+0100 NonEuclidean[62142:2193080] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=62142
2021-03-14 19:16:24.091957+0100 NonEuclidean[62142:2193080] SecTaskCopyDebugDescription: NonEuclidean[62142]/0#-1 LF=0
2021-03-14 19:16:24.350535+0100 NonEuclidean[62142:2193080] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x10052c560> F8BB1C28-BAE8-11D6-9C31-00039315CD46
Process 62142 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (NonEuclidean) stopped.

I also have to add -std=c++11 for it to compile btw, it complains about a bunch of stuff otherwise and gives an error that

error: a space is required between consecutive
      right angle brackets (use '> >')
Srinivasa314 commented 3 years ago

I think I fixed it. Check if it works now.

rsmath commented 2 years ago

Hello, where can I get the code that compiles and works on mac please? Thank you.

rsmath commented 2 years ago

@Srinivasa314 @Srikanth-M-02 could you please tell me how to get the code that will run on Mac?

Srinivasa314 commented 2 years ago

1) Download xcode command line tools 2) install glew and sdl2 (you can use brew install) 3) git clone https://github.com/Srinivasa314/NonEuclidean then cd NonEuclidean/NonEuclidean 4) export CPATH="/opt/homebrew/Cellar/glew/2.2.0_1/include/:/opt/homebrew/Cellar/sdl2/2.24.0/include/" export LIBRARY_PATH="/opt/homebrew/Cellar/sdl2/2.24.0/lib:/opt/homebrew/Cellar/glew/2.2.0_1/lib" 5) change the above command depending on where glew and sdl2 were installed 6) run make all 7) ./NonEuclidean As of now scenes 4 and 7 dont work properly on my mac

Srinivasa314 commented 2 years ago

Is it working @ramanshsharma2806 ?

Srinivasa314 commented 2 years ago

Btw scene 4 works if I replace the bunny.obj and suzanne.obj with other obj files and scene 7 works if I disable GL_LINEAR_MIPMAP_NEAREST and glGenerateMipmap

Sussy-OS commented 2 years ago

Would PR #26 work with this? Currently, if you were to put glew-2.1.0 in the directory with the .exe, it would fail to build. #26 fixes this. It would be handy, (with permission) to merge that PR into this one.

ehx-v1 commented 2 years ago

@Sussy-OS They're PRs for the same repo anyway, so the permission should already be implicitly there. Would definitely be great if this worked.