Guevara-chan / Raylib-Forever

:.raylib headers for Nim anytime.:
https://guevara-chan.github.io/Raylib-Forever/main.html
75 stars 4 forks source link

3d Bindings not working on osx? #9

Open Zed-Bailey opened 4 years ago

Zed-Bailey commented 4 years ago

The bindings for any 3d objects do not display on osx, from my testing everything 2d works(shapes, text, images, etc..), I thought it may've been my code so i tested some of the 3d examples and even then nothing 3d is displaying(2D boxes and text are working) Im not sure if this is osx itself or if i'm not linking something properly

cheers, Zed

Guevara-chan commented 4 years ago

Hm. Does non-wrapped Raylib work for you on OSX ?

Zed-Bailey commented 4 years ago

Yeah i just tested running the core 3d camera first person example and that works properly, I think it may be how i'm compiling the files. How are you compiling a file with the bindings?

Guevara-chan commented 4 years ago

Hm. Actually, I use gcc to compile & test all samples and my own raylib-powered project. Experienced almost to none problems on Win x86/x64.

Zed-Bailey commented 4 years ago

How are you compiling the nim files?

Guevara-chan commented 4 years ago

nim c -r --verbosity:0 --hints:off file$ ¯\(ツ)

Tim-Hartmann commented 4 years ago

I seem to have the same problem on Linux. 2d and shaders work, everything else is not drawn.

Guevara-chan commented 4 years ago

Can you, like, provide some minimal example of code that does not work ?

Tim-Hartmann commented 4 years ago

I have not actually gotten to write any code, I just tried the examples.

Both examples in shaders work perfectly.

core/camera_3d_first_person displays the blue controls UI element in the top left corner but a white screen otherwise. Same for core/picking_3d.

The examples in models just show a white screen with the fps counter.

The examples in text work (I think, but there is no text in the rectangle in text/rectangle_bound). Input box works great.

Examples in textures work perfectly (Except for raw_data which i can't compile because of undeclared identifier: 'LoadImageEx')

Examples in shapes work (except draw_ring because i haven't built raygui yet).

So it seems that BeginMode3D is somehow broken, but I don't see any obvious reason why it should be, as vanilla raylib works and all other functionality of raylib seems to work with your wrapper.

Guevara-chan commented 4 years ago

Wow, nice catch about raw_data - just fixed it. Now, as for 3D stuff... I can't reproduce it at all on my Win10, per se: image image

Wazubaba commented 4 years ago

I can also confirm that 3d support is not working on linux. I tested using the provided 3d fps example, and can report the same issue - gui renders, nothing else in the 3d scene does. Just to be certain I tested whether raylib itself's 3d renderer works properly on linux using their C version of the 3d fps example and it worked fine on the same build of the library I'm using to test raylib-forever.

I dug through the raylib.nim module but I can't really see anything that looks off (other than an unrelated issue which I submitted), though the rlgl module is broken and reports that VertexBuffer is an undeclared identifier when I tried importing that just to see if maybe somehow that was why 3d support was broken on my build of latest raylib from git.

Wazubaba commented 4 years ago

Update: I am very, very confused. So I fixed my local copy of rlgl.nim with the two missing types VertexBuffer and DrawCall. That didn't help. I've even set up a module that builds all of raylib and raygui with compile directives to directly wire raylib into things and then edited the various raylib-forever modules to not use dynlib and it still seems to be having the same issue - everything but 3d works. So far I've tested:

and they've all worked just fine.

I'm wondering if you might not want to consider raising this to the nim repo's issue tracker because I don't think this is a raylib-forever issue, but something strange going on with nim itself, since you've demonstrated it works on windows yet it doesn't work elsewhere with the same code despite raylib itself working fine outside of nim. I tested this with latest nim stable 1.2.6.

Zed-Bailey commented 4 years ago

Hmm...I haven't used raylib in a while now, but i saw somewhere that this problem may lie in not having the dll linked with the executable using --passL:raylib.dll( i may be wrong on the flag syntax) but it seems like something worth testing

Wazubaba commented 4 years ago

That's taken care of in raylib.nim via the dynlib pragmas, and anything built calling functions from it that cannot find the lib in question will exit with an error message complaining about not being able to find raylib. I had a similar idea which is why I tried the approach I mentioned in my post prior to yours. Still same issue though - seemingly everything but 3d rendering works, with all 3d draws not drawing anything at all to the screen.