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

Unable to see VR controller in godot_openvr demo #67

Open
georgewsinger opened this issue Sep 17, 2019 · 46 comments
Open

Unable to see VR controller in godot_openvr demo #67

georgewsinger opened this issue Sep 17, 2019 · 46 comments

Comments

@georgewsinger
Copy link

georgewsinger commented Sep 17, 2019

Running Ubuntu 19.04 + nvidia 418.56 + godot on the 3.1 branch, I compiled godot_openvr via

git clone --branch master --recursive https://github.com/GodotVR/godot_openvr.git godot_openvr
cd godot_openvr
cd godot-cpp
scons platform=linux target=release generate_bindings=yes bits=64
cd ..
scons platform=linux target=release

and launched the demo via

cd demo
godot
# godot -e # I also tried launching the demo via the editor

The demo looks like this:

but I am not able to use HTC Vive controllers. FWIW I also see a constant stream of

ERROR: find_by_type_and_id: Condition ' p_tracker_id == 0 ' is true. returned: __null
   At: servers/arvr_server.cpp:305.

in the console. If I try to run the demo again (running pkill godot first), the demo launches the same except not in my HMD (I only see it in "pancake mode" in the window):

sometimes followed by a popup

Note that I only see the table in front of me in pancake mode, not in the actual VR demo.

@BastiaanOlij
Copy link
Member

@georgewsinger there was a writeup that @beniwtv did one of the info issues on this job, that describes a number of things you need to be aware off on Linux. Unfortunately I don't use Linux myself but it has a few gotcha's if I understand correctly

@beniwtv
Copy link
Collaborator

beniwtv commented Sep 22, 2019

The tracker error is due to a bug in the demo - the ID of the left (IIRC) controller is set to 0 instead of one.

@beniwtv
Copy link
Collaborator

beniwtv commented Sep 22, 2019

The special Linux things to be aware of are in the README - under "Linux notes". However, I have not needed this on Manjaro anymore - and since the demo does display in the HMD this seems to be fine for you as well.

@Olm-e
Copy link

Olm-e commented Oct 7, 2019

be sure to have launched it through the SteamVR system environment :

  • you can use steam to launch steamvr and add your godot editor in as a vr app,

  • or you can just launch the vr monitor without steam like this :

cd ~/.steam/steam/ubuntu12_32/steam-runtime/

./run.sh ../../steamapps/common/SteamVR/bin/vrmonitor.sh

and in another terminal to run godot under the same dir with

./run.sh /path/to/your/godotbinary

also verify your compilation flags (godot-cpp compiled with platform=windows) ...

alternatively, I could verify it works also well and easily to use godot 3.2 with the online add-on repository to add the Godot-ARVR addon on debian 10 with off. nvidia drivers

@georgewsinger
Copy link
Author

georgewsinger commented Oct 28, 2019

you can use steam to launch steamvr and add your godot editor in as a vr app,

@Olm-e I launched via this way just to make sure, and I'm still not getting a controller in the demo. (Also: I didn't compile godot-cpp with platform=windows; that was just a typo in my question which I just corrected).

The tracker error is due to a bug in the demo - the ID of the left (IIRC) controller is set to 0 instead of one.

@beniwtv Is fixing this error required to get controller functionality working in the demo?

@beniwtv
Copy link
Collaborator

beniwtv commented Oct 28, 2019

Yes for that controller it wouldn't work if the tracker ID is 0.

@georgewsinger
Copy link
Author

georgewsinger commented Oct 29, 2019

@beniwtv I'm assuming the thing to change is

func load_controller_mesh(controller_name):
	# if ovr_render_model.load_model(controller_name.substr(0, controller_name.length()-2)):
	if ovr_render_model.load_model(controller_name.substr(1, controller_name.length()-2)):
		return ovr_render_model
       # ...

in ovr_controller.gd? If so, this doesn't seem to fix the issue. This sounds like it could be near to the problem though since I only have one Vive controller on my system (perhaps this is why I'm the only person getting this error? :)

@beniwtv
Copy link
Collaborator

beniwtv commented Oct 29, 2019

Nope, it's in the Godot scene -> click on the left controller and in the inspector set the controller ID property.

@georgewsinger
Copy link
Author

Nope, it's in the Godot scene -> click on the left controller and in the inspector set the controller ID property.

Adjusting this as follows (see top right of picture: "Controller Id" is set to "1"):

I now get the following launch crash:

OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
Construct gdnative interface
Usage count increased to 2
Usage count increased to 3
OpenVR: initialising OpenVR context

/home/george/.steam/steam/steamapps/common/SteamVR/bin/linux64/vrdashboard: error while loading shared libraries: libopenvr_api.so: cannot open shared object file: No such file or directory
Application in scene (normal) mode.
Main OpenVR interface has been initialized
Main render models interface has been initialized.
Found controller 1 (vr_controller_vive_1_5)
Found base station 2 (lh_basestation_vive)
Controller vr_controller_vive_1_5_1 became active
Loading: vr_controller_vive_1_5
ERROR: find_by_type_and_id: Condition ' p_tracker_id == 0 ' is true. returned: __null
   At: servers/arvr_server.cpp:305.
shaders/vulkan/distort_vs.spv
shaders/vulkan/distort_vs_layered.spv
shaders/vulkan/distort_vs_nd.spv
shaders/vulkan/distort_vs_latest_nd.spv
shaders/vulkan/distort_vs_layered_nd.spv
shaders/vulkan/distort_vs_reproject.spv
shaders/vulkan/distort_vs_reproject_nd.spv
shaders/vulkan/distort_vs_reproject_mv.spv
shaders/vulkan/distort_geom_vs.spv
shaders/vulkan/distort_geom_uvs_embedded_vs.spv
shaders/vulkan/distort_geom_aa_lines_vs.spv
shaders/vulkan/distort_geom_aa_circles_vs.spv
shaders/vulkan/distort_geom_hard_bounds_aa_lines_vs.spv
shaders/vulkan/distort_geom_hard_bounds_aa_squares_vs.spv
shaders/vulkan/distort_geom_aa_quads_vs.spv
shaders/vulkan/distort_geom_grid_vs.spv
shaders/vulkan/distort_none_vs.spv
shaders/vulkan/distort_panorama_vs.spv
shaders/vulkan/panel_mask_vs.spv
shaders/vulkan/downsample_vs.spv
shaders/vulkan/msaa_resolve_vs.spv
shaders/vulkan/tracked_camera_vs.spv
shaders/vulkan/tracked_camera_undistort_vs.spv
shaders/vulkan/tracked_camera_edgefilter_vs.spv
shaders/vulkan/tracked_camera_reprojection_vs.spv
shaders/vulkan/tracked_camera_lines_vs.spv
shaders/vulkan/gpu_measurement_vs.spv
shaders/vulkan/frame_hallucination_vs.spv
shaders/vulkan/motion_smoothing_debug_vs.spv
shaders/vulkan/motion_filter_vs.spv
shaders/vulkan/motion_filter_early_out_vs.spv
shaders/vulkan/unlit_vs.spv
shaders/vulkan/distort_ps.spv
shaders/vulkan/distort_ps_gamma.spv
shaders/vulkan/distort_ps_layered.spv
shaders/vulkan/distort_ps_mc.spv
shaders/vulkan/distort_ps_gamma_mc.spv
shaders/vulkan/distort_ps_layered_mc.spv
shaders/vulkan/distort_ps_nd.spv
shaders/vulkan/distort_ps_gamma_nd.spv
shaders/vulkan/distort_ps_layered_nd.spv
shaders/vulkan/distort_ps_mc_nd.spv
shaders/vulkan/distort_ps_gamma_mc_nd.spv
shaders/vulkan/distort_ps_layered_mc_nd.spv
shaders/vulkan/distort_ps_scene.spv
shaders/vulkan/distort_ps_scene0.spv
shaders/vulkan/distort_ps_scene_blur.spv
shaders/vulkan/distort_geom_ps.spv
shaders/vulkan/distort_geom_multitap_ps.spv
shaders/vulkan/distort_geom_aa_lines_ps.spv
shaders/vulkan/distort_geom_aa_circles_ps.spv
shaders/vulkan/distort_geom_hard_bounds_aa_lines_ps.spv
shaders/vulkan/distort_geom_hard_bounds_aa_squares_ps.spv
shaders/vulkan/distort_geom_aa_quads_ps.spv
shaders/vulkan/distort_geom_grid_ps.spv
shaders/vulkan/distort_none_ps.spv
shaders/vulkan/distort_none_ps_gamma.spv
shaders/vulkan/distort_none_ps_layered.spv
shaders/vulkan/distort_panorama_ps.spv
shaders/vulkan/distort_panorama_dome_ps.spv
shaders/vulkan/distort_panorama_dome_radius_ps.spv
shaders/vulkan/panel_mask_ps.spv
shaders/vulkan/downsample_ps.spv
shaders/vulkan/downsample_srgb_ps.spv
shaders/vulkan/downsample_filter_x_ps.spv
shaders/vulkan/downsample_filter_x_srgb_ps.spv
shaders/vulkan/downsample_filter_y_ps.spv
shaders/vulkan/downsample_filter_y_srgb_ps.spv
shaders/vulkan/msaa_resolve_2x_ps.spv
shaders/vulkan/msaa_resolve_4x_ps.spv
shaders/vulkan/msaa_resolve_8x_ps.spv
shaders/vulkan/tracked_camera_ps.spv
shaders/vulkan/tracked_camera_undistort_ps.spv
shaders/vulkan/tracked_camera_edgefilter_ps.spv
shaders/vulkan/tracked_camera_reprojection_ps.spv
shaders/vulkan/tracked_camera_lines_ps.spv
shaders/vulkan/gpu_measurement_ps.spv
shaders/vulkan/frame_hallucination_ps.spv
shaders/vulkan/motion_smoothing_debug_ps.spv
shaders/vulkan/motion_filter_attenuation_ps.spv
shaders/vulkan/motion_filter_median_ps.spv
shaders/vulkan/motion_filter_cost_ps.spv
shaders/vulkan/motion_filter_blur_ps.spv
shaders/vulkan/unlit_ps.spv
shaders/vulkan/unlit_sint16_ps.spv
shaders/vulkan/unlit_motion_vectors_ps.spv
shaders/vulkan/unlit_motion_cost_ps.spv
shaders/vulkan/unlit_convert_to_nv12_ps.spv
shaders/vulkan/unlit_motion_color_diff_ps.spv
shaders/vulkan/unlit_motion_vector_diff_ps.spv
shaders/vulkan/unlit_motion_attenuation_ps.spv
shaders/vulkan/distort_cs.spv
shaders/vulkan/distort_cs_mc.spv
shaders/vulkan/linepixelsim_cs.spv
shaders/vulkan/linepixelsim2_cs.spv
shaders/vulkan/testgrid_cs.spv
shaders/vulkan/motionvector_cost_cs.spv
Game FPS: 1
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x43f60) [0x7f2e0d187f60] (??:0)
[2] /home/george/Simula/bin/godot(godot_method_bind_ptrcall+0x2c) [0x159654b] (/home/george/Simula/build/godot/modules/gdnative/gdnative/gdnative.cpp:69)
[3] godot::Mesh::surface_set_material(long, godot::Ref<godot::Material>) (??:0)
[4] openvr_data::_load_render_model(openvr_data::model_mesh*) (??:0)
[5] openvr_data::process() (??:0)
[6] /home/george/godot_openvr/demo/addons/godot-openvr/bin/x11/libgodot_openvr.so(+0x10006e) [0x7f2e0284706e] (??:0)
[7] ARVRInterfaceGDNative::process() (/home/george/Simula/build/godot/modules/gdnative/arvr/arvr_interface_gdnative.cpp:212)
[8] ARVRServer::_process() (/home/george/Simula/build/godot/servers/arvr_server.cpp:352 (discriminator 2))
[9] VisualServerViewport::draw_viewports() (/home/george/Simula/build/godot/servers/visual/visual_server_viewport.cpp:252)
[10] VisualServerRaster::draw(bool, double) (/home/george/Simula/build/godot/servers/visual/visual_server_raster.cpp:107 (discriminator 2))
[11] VisualServerWrapMT::draw(bool, double) (/home/george/Simula/build/godot/servers/visual/visual_server_wrap_mt.cpp:104)
[12] Main::iteration() (/home/george/Simula/build/godot/main/main.cpp:1893)
[13] OS_X11::run() (/home/george/Simula/build/godot/platform/x11/os_x11.cpp:3006)
[14] /home/george/Simula/bin/godot(main+0xdc) [0x119e65e] (/home/george/Simula/build/godot/platform/x11/godot_x11.cpp:56)
[15] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f2e0d16ab6b] (??:0)
[16] /home/george/Simula/bin/godot(_start+0x2a) [0x119e4ca] (??:?)
-- END OF BACKTRACE --
Aborted (core dumped)

@beniwtv
Copy link
Collaborator

beniwtv commented Oct 29, 2019

I remember there being a crash about materials, this seems to look like it. From what I remember that was an incompatible Godot version to the OpenVR plugin.

This might require downgrading the godot-cpp headers to a suitable version. In my PR there should be an .so that works with Godot 3.1: #64

@georgewsinger
Copy link
Author

This might require downgrading the godot-cpp headers to a suitable version.

I'm assuming you're referring to changing godot-cpp's branch before compiling? Since I'm running Godot on the 3.1 branch, I'm assuming I would need the 3.1 branch; however, I tried each of the following branches and got compilation errors: (i) master, (ii) 3.1, (iii) nativescript-1.0 and (iv) nativescript-1.1.

I'm looking forward to testing your pull request but am having trouble getting it up and running (see here).

@beniwtv
Copy link
Collaborator

beniwtv commented Oct 30, 2019

Can you post some of the compilation errors?

@georgewsinger
Copy link
Author

For 3.1 branch of godot-cpp, here is some of the error output:

src/gen/__init_method_bindings.cpp:954:31: error: '___init_method_bindings' is not a member of 'godot::PhysicsShapeQueryParameters'
  PhysicsShapeQueryParameters::___init_method_bindings();
                               ^~~~~~~~~~~~~~~~~~~~~~~
src/gen/__init_method_bindings.cpp:955:27: error: '___init_method_bindings' is not a member of 'godot::PhysicsShapeQueryResult'
  PhysicsShapeQueryResult::___init_method_bindings();
                           ^~~~~~~~~~~~~~~~~~~~~~~
src/gen/__init_method_bindings.cpp:956:12: error: '___init_method_bindings' is not a member of 'godot::PinJoint'
  PinJoint::___init_method_bindings();
            ^~~~~~~~~~~~~~~~~~~~~~~

(This repeats for a long while).

@georgewsinger
Copy link
Author

Has godot_openvr been confirmed to run properly on Linux for other people?

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 1, 2019

Yes, definitively, I have other Linux users for my VR overlay (albeit with the pre-compiled binaries for the module).

That error above still looks to me like an inconsistency between the headers. Let me look which exact headers commit I use.

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 1, 2019

Here they are:

cdd50260d0c2bd620f15d16e2e00a4d8c965eb67 godot-cpp (v1.0.0-alpha2-146-gcdd5026)
52065df3d6f3af96300dac98cdf7397f26abfcd7 openvr (v.1.6.10b)

@georgewsinger
Copy link
Author

@beniwtv Retrieving those branches via

cd godot-cpp
git checkout cdd50260d0c2bd620f15d16e2e00a4d8c965eb67
scons platform=linux target=release generate_bindings=yes bits=64
cd ..

cd openvr
git checkout 52065df3d6f3af96300dac98cdf7397f26abfcd7
cd ..

scons platform=linux target=release

I get the following compilation error:

george@UbuntuBox:~/godot_openvr_custom$ scons platform=linux target=release
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/ARVRInterface.os -c -std=c++0x -fPIC -g -O3 -std=c++17 -fPIC -I. -Isrc -Isrc/open_vr -Igodot-cpp/godot_headers -Igodot-cpp/include -Igodot-cpp/include/core -Igodot-cpp/include/gen -Iopenvr/headers src/ARVRInterface.cpp
src/ARVRInterface.cpp: In function 'void godot_attach_device(arvr_data_struct*, uint32_t)':
src/ARVRInterface.cpp:54:51: error: 'arvr_api' is not a member of 'godot'
   p_arvr_data->trackers[p_device_index] = godot::arvr_api->godot_arvr_add_controller(device_name, hand, true, true);
                                                  ^~~~~~~~

src/ARVRInterface.cpp: In function 'void godot_detach_device(arvr_data_struct*, uint32_t)':
src/ARVRInterface.cpp:70:10: error: 'arvr_api' is not a member of 'godot'
   godot::arvr_api->godot_arvr_remove_controller(p_arvr_data->trackers[p_device_index]);
          ^~~~~~~~
src/ARVRInterface.cpp: In function 'godot_transform godot_arvr_get_transform_for_eye(void*, godot_int, godot_transform*)':
src/ARVRInterface.cpp:203:43: error: 'arvr_api' is not a member of 'godot'
  godot_transform reference_frame = godot::arvr_api->godot_arvr_get_reference_frame();
                                           ^~~~~~~~
src/ARVRInterface.cpp:205:34: error: 'arvr_api' is not a member of 'godot'
  godot_real world_scale = godot::arvr_api->godot_arvr_get_worldscale();
                                  ^~~~~~~~
src/ARVRInterface.cpp: In function 'void godot_arvr_commit_for_eye(void*, godot_int, godot_rid*, godot_rect2*)':
src/ARVRInterface.cpp:286:10: error: 'arvr_api' is not a member of 'godot'
   godot::arvr_api->godot_arvr_blit(0, p_render_target, (godot_rect2 *)&screen_rect);
          ^~~~~~~~
src/ARVRInterface.cpp:296:27: error: 'arvr_api' is not a member of 'godot'
   uint32_t texid = godot::arvr_api->godot_arvr_get_texid(p_render_target);
                           ^~~~~~~~
src/ARVRInterface.cpp: In function 'void godot_arvr_process(void*)':
src/ARVRInterface.cpp:360:14: error: 'arvr_api' is not a member of 'godot'
       godot::arvr_api->godot_arvr_set_controller_button(arvr_data->trackers[event.trackedDeviceIndex], button, true);
              ^~~~~~~~
src/ARVRInterface.cpp:372:14: error: 'arvr_api' is not a member of 'godot'
       godot::arvr_api->godot_arvr_set_controller_button(arvr_data->trackers[event.trackedDeviceIndex], button, false);
              ^~~~~~~~
src/ARVRInterface.cpp:399:35: error: 'arvr_api' is not a member of 'godot'
   godot_real world_scale = godot::arvr_api->godot_arvr_get_worldscale();
                                   ^~~~~~~~
src/ARVRInterface.cpp:416:13: error: 'arvr_api' is not a member of 'godot'
      godot::arvr_api->godot_arvr_set_controller_transform(arvr_data->trackers[i],
             ^~~~~~~~
src/ARVRInterface.cpp:436:17: error: 'arvr_api' is not a member of 'godot'
          godot::arvr_api->godot_arvr_set_controller_axis(
                 ^~~~~~~~
src/ARVRInterface.cpp:443:17: error: 'arvr_api' is not a member of 'godot'
          godot::arvr_api->godot_arvr_set_controller_axis(
                 ^~~~~~~~
src/ARVRInterface.cpp:449:17: error: 'arvr_api' is not a member of 'godot'
          godot::arvr_api->godot_arvr_set_controller_axis(
                 ^~~~~~~~
src/ARVRInterface.cpp:460:28: error: 'arvr_api' is not a member of 'godot'
      float rumble = godot::arvr_api->godot_arvr_get_controller_rumble(arvr_data->trackers[i]);
                            ^~~~~~~~
scons: *** [src/ARVRInterface.os] Error 1
scons: building terminated because of errors.

@georgewsinger
Copy link
Author

georgewsinger commented Nov 2, 2019

Binaries? Does anyone have binaries they can lend me of a working linux godot-openvr? The ones in ./demo/addons/godot-openvr/bin/x11 haven't been updated since August:

image

I tried copying these binaries to my project (SimulaVR/Simula) and I get what appear to be godot-cpp errors during a call to ARVRInterfaceGDNative::initialize():

(gdb) bt
#0  0x000000000159654b in godot_method_bind_ptrcall(godot_method_bind*, godot_object*, void const**, void*)
    (p_method_bind=0x0, p_instance=0x4d160c0, p_args=0x7fffffff9360, p_ret=0x7fffffff9358)
    at modules/gdnative/gdnative/gdnative.cpp:69
#1  0x00007fffed4640eb in godot::___godot_icall_int (inst=0x6e2bed0, mb=<optimized out>)
    at include/gen/__icalls.hpp:6399
#2  0x00007fffed4640eb in godot::OS::get_current_video_driver() const
    (this=this@entry=0x6e2bed0) at src/gen/OS.cpp:226
#3  0x00007fffed44ae33 in godot_arvr_initialize(void*) (p_data=0x64505b0)
    at godot-cpp/include/gen/OS.hpp:156
#4  0x00000000015b927a in ARVRInterfaceGDNative::initialize() (this=0x645b6f0)
    at modules/gdnative/arvr/arvr_interface_gdnative.cpp:143
#5  0x0000000001575d0b in MethodBind0R<bool>::call(Object*, Variant const**, int, Variant::CallError&)
    (this=0x5eb13f0, p_object=0x645b6f0, p_args=0x420005e9b8, p_arg_count=0, r_error=...)
    at ./core/method_bind.gen.inc:222
#6  0x00000000015965fa in godot_method_bind_call(godot_method_bind*, godot_object*, godot_variant const**, int, godot_variant_call_error*)
    (p_method_bind=0x5eb13f0, p_instance=0x645b6f0, p_args=0x420005e9b8, p_arg_count=0, p_call_error=0x420005e9c8) at modules/gdnative/gdnative/gdnative.cpp:83
#7  0x00007fffe2d44993 in hs_shim_godot_method_bind_call ()
    at /home/george/Simula/addons/godot-haskell-plugin/.stack-work/install/x86_64-linux-tinfo6/aed48248d5ad6c739134c4336e043f8c41e1fac67b7a02218f17d4d4f872fca7/8.6.3/lib/x86_64-linux-ghc-8.6.3/libHSgodot-haskell-3.1.0.0-2fLCyvlk4a1LWwJbEUJ90a-ghc8.6.3.so
#8  0x00007fffe2cc811c in  ()
    at /home/george/Simula/addons/godot-haskell-plugin/.stack-work/install/x86_64-linux-tinfo6/aed48248d5ad6c739134c4336e043f8c41e1fac67b7a02218f17d4d4f872fca7/8.6.3/lib/x86_64-linux-ghc-8.6.3/libHSgodot-haskell-3.1.0.0-2fLCyvlk4a1LWwJbEUJ90a-ghc8.6.3.so

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 2, 2019

Let me try downloading your project and trying it here.

For Godot 3.1.1 from the official these binaries do work for me in the demo (I did compile them after all) :)

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 2, 2019

Hmm I fail to make it detect wayland_scanner. I installed pywayland, but to no avail. Do I need to do something special there?

@georgewsinger
Copy link
Author

Can you post the console error/distro you're using?

If you're using Ubuntu make ubuntu should install all of the needed dependencies (including in this case: wayland, wayland-protocols, and libwayland-dev).

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 2, 2019

I'm using Manjaro, error is:

scons platform=x11 target=debug -j 16
scons: Reading SConscript files ...
Enabling ALSA
Enabling PulseAudio
ModuleNotFoundError: No module named 'wayland_scanner':
  File "/home/beniwtv/build/Simula/resources/build/godot/SConstruct", line 495:
    SConscript("modules/SCsub")
  File "/usr/lib/python3.7/site-packages/SCons/Script/SConscript.py", line 668:
    return method(*args, **kw)
  File "/usr/lib/python3.7/site-packages/SCons/Script/SConscript.py", line 605:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/python3.7/site-packages/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/beniwtv/build/Simula/resources/build/godot/modules/SCsub", line 17:
    SConscript(x + "/SCsub")
  File "/usr/lib/python3.7/site-packages/SCons/Script/SConscript.py", line 668:
    return method(*args, **kw)
  File "/usr/lib/python3.7/site-packages/SCons/Script/SConscript.py", line 605:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/python3.7/site-packages/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/beniwtv/build/Simula/resources/build/godot/modules/gdwlroots/SCsub", line 25:
    module_env = env.Clone(tools=['wayland-scanner'], toolpath=['tools'])
  File "/usr/lib/python3.7/site-packages/SCons/Environment.py", line 1422:
    apply_tools(clone, tools, toolpath)
  File "/usr/lib/python3.7/site-packages/SCons/Environment.py", line 107:
    env.Tool(tool)
  File "/usr/lib/python3.7/site-packages/SCons/Environment.py", line 1798:
    tool = SCons.Tool.Tool(tool, toolpath, **kw)
  File "/usr/lib/python3.7/site-packages/SCons/Tool/__init__.py", line 122:
    module = self._tool_module()
  File "/usr/lib/python3.7/site-packages/SCons/Tool/__init__.py", line 239:
    module = spec.loader.load_module(spec.name)
  File "<frozen importlib._bootstrap_external>", line 407:
    
  File "<frozen importlib._bootstrap_external>", line 907:
    
  File "<frozen importlib._bootstrap_external>", line 732:
    
  File "<frozen importlib._bootstrap>", line 265:
    
  File "<frozen importlib._bootstrap>", line 696:
    
  File "<frozen importlib._bootstrap>", line 677:
    
  File "<frozen importlib._bootstrap_external>", line 728:
    
  File "<frozen importlib._bootstrap>", line 219:
    
  File "/home/beniwtv/build/Simula/resources/build/godot/modules/gdwlroots/tools/wayland-scanner/__init__.py", line 1:
    from wayland_scanner import exists, generate, WaylandScanner

@georgewsinger
Copy link
Author

georgewsinger commented Nov 2, 2019

@beniwtv Thanks for your help.

  1. Simula + Manjaro. Simula is a dev project that's only confirmed to work on Ubuntu right now :[ That said, there's nothing in principle stopping it from working on other distros. Does manjaro use pacman as its package manager (like Arch Linux)? If so, you can try running make arch to install a bunch of dependencies. Wayland-scanner should be provided by wayland-scanner and/or wayland in pacman.

  2. godot-cpp errors. I don't want you to get sucked into trying to get Simula to run on your machine if you've got other stuff going on. Do you have any clue what might be causing those compilation errors I've been getting? You mentioned you were using Godot 3.1.1. Is this distinct from the godot provided by the 3.1 branch of godotengine/godot?

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 2, 2019

I do have Wayland as I use this as my primary display server, but I can't find wayland-scanner here :(

The Godot 3.1 branch should be the correct one - but I just saw that in godot_openvr master Bastiaan did update the cpp bindings -> maybe try rolling back the godot_openvr repo to commit cd58016 for those compile issues

@georgewsinger
Copy link
Author

georgewsinger commented Nov 3, 2019

@beniwtv Pinning the commit to the one you specified gets godot_openvr to compile(!):

git checkout cd58016a5edb4e626b0bee830de1d723c1b46a57
cd godot-cpp
scons platform=linux target=release generate_bindings=yes bits=64
cd ..

scons platform=linux target=release

However, I'm unable to find the updated lib/binary in the project? The contents of ./demo/addons/godot-openvr didn't seem to change (and I get the same godot-cpp run-time error when importing it to Simula). Do you know how I can obtain the updated binary/lib from the successful compilation above?

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 3, 2019

Try to clean the build with scons -c then recompile.

@georgewsinger
Copy link
Author

georgewsinger commented Nov 3, 2019

@beniwtv: After running scons -c followed by scons platform=linux target=release, I get the same result, including the message:

scons: `demo/addons/godot-openvr/bin/x11/libgodot_openvr.so' is up to date.

I tried deleting demo/addons/godot-openvr/bin/x11/libgodot_openvr.so and recompiling (which successfully regenerated the file); however, when I copy it back into Simula I get the same godot-cpp runtime error above.

Question: You suggested using cd58016a5edb4e626b0bee830de1d723c1b46a57 as my godot_openvr commit, should I also adjust godot-cpp and openvr commits also?

EDIT: Woops. I accidentally closed (and reopened) this issue.

@georgewsinger
Copy link
Author

I tried again with the following combination:

cd58016a5edb4e626b0bee830de1d723c1b46a57 godot_openvr
cdd50260d0c2bd620f15d16e2e00a4d8c965eb67 godot-cpp (v1.0.0-alpha2-146-gcdd5026)
52065df3d6f3af96300dac98cdf7397f26abfcd7 openvr (v.1.6.10b)

and ran into the same issue. While everything compiles, I get the same godot-cpp run-time error in Simula.

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 3, 2019

And that is with Godot 3.1.1?

@georgewsinger
Copy link
Author

georgewsinger commented Nov 3, 2019

This is using the version of Godot compiled from the 3.1 branch, or more specifically, the 8acaac10b6458fe1ed76877a38149e4c2966baa3 commit from Sep 3rd, 2019 of the 3.1 branch of godotengine/godot.

EDIT: For good measured I tried this with godotengine/godot's 3.1.1-stable (66baa3b) and got the same run-time godot-cpp error as above.

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 4, 2019

Is that with or without the Haskell plugin?

@georgewsinger
Copy link
Author

It's with the godot-haskell-plugin.so (which is just Simula). The crash is caused when we call ARVRInterface::initialize() from our Haskell bindings.

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 4, 2019

Can you run plain Godot 3.1.1 + the demo with your compiled module, does that work?
(Just trying to figure out here if the Haskell bindings may need an update)

@georgewsinger
Copy link
Author

@beniwtv With the demo I'm getting the Milkyway.png resource error again (like with your PR).

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 4, 2019

I'm really puzzled about that milkyway thing - but I guess you can remove the reference to it and still test if it runs

@georgewsinger
Copy link
Author

@beniwtv I removed references to Milkyway.png in Main.tscn as follows. Launching the demo (I'm remote until tonight, so I can't see the actual Godot window; lmk if this is an issue) yields

OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
Construct gdnative interface
Usage count increased to 2
Usage count increased to 3
OpenVR: initialising OpenVR context

Application in scene (normal) mode.
Unable to init VR runtime: Hmd Not Found Presence Failed (126)
Game FPS: 2
Game FPS: 3561
Game FPS: 3940
# ..

followed by several errors of form

ERROR: find_by_type_and_id: Condition ' p_tracker_id == 0 ' is true. returned: __null
   At: servers/arvr_server.cpp:305.

that flood the console (probably because controller id needs changed to 1, which I can adjust when I have access to the godot GUI). So it looks like the demo is running fine modulo this issue?

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 4, 2019

Yes that seems ok to me (the tracker is indeed that it needs to be changed)

@georgewsinger
Copy link
Author

georgewsinger commented Nov 4, 2019

So this seems to indicate that the call to ARVRInterface::initialize() works from GDScript but not from Haskell. The specific backtrace from Haskell is:

(gdb) bt
#0  0x000000000159654b in godot_method_bind_ptrcall(godot_method_bind*, godot_object*, void const**, void*)
    (p_method_bind=0x0, p_instance=0x4d160c0, p_args=0x7fffffff9360, p_ret=0x7fffffff9358)
    at modules/gdnative/gdnative/gdnative.cpp:69
#1  0x00007fffed4640eb in godot::___godot_icall_int (inst=0x6e2bed0, mb=<optimized out>)
    at include/gen/__icalls.hpp:6399
#2  0x00007fffed4640eb in godot::OS::get_current_video_driver() const
    (this=this@entry=0x6e2bed0) at src/gen/OS.cpp:226
#3  0x00007fffed44ae33 in godot_arvr_initialize(void*) (p_data=0x64505b0)
    at godot-cpp/include/gen/OS.hpp:156
#4  0x00000000015b927a in ARVRInterfaceGDNative::initialize() (this=0x645b6f0)
    at modules/gdnative/arvr/arvr_interface_gdnative.cpp:143
#5  0x0000000001575d0b in MethodBind0R<bool>::call(Object*, Variant const**, int, Variant::CallError&)
    (this=0x5eb13f0, p_object=0x645b6f0, p_args=0x420005e9b8, p_arg_count=0, r_error=...)
    at ./core/method_bind.gen.inc:222
#6  0x00000000015965fa in godot_method_bind_call(godot_method_bind*, godot_object*, godot_variant const**, int, godot_variant_call_error*)
    (p_method_bind=0x5eb13f0, p_instance=0x645b6f0, p_args=0x420005e9b8, p_arg_count=0, p_call_error=0x420005e9c8) at modules/gdnative/gdnative/gdnative.cpp:83
#7  0x00007fffe2d44993 in hs_shim_godot_method_bind_call ()

Which indicates that when we call initialize from Haskell, godot calls godot_arvr_intialize() (which is located in godot-openvr), which then calls godot::OS::get_singleton()->get_current_video_driver() (which is back in godot). That last transition from godot-openvr -> godot uses godot_method_bind_ptrcall with an empty binding for some reason.

EDIT: Our Haskell binding

bindARVRInterface_initialize
  = unsafePerformIO $
      withCString "ARVRInterface" $
        \ clsNamePtr ->
          withCString "initialize" $
            \ methodNamePtr ->
              godot_method_bind_get_method clsNamePtr methodNamePtr

{-# NOINLINE bindARVRInterface_initialize #-}

instance Method "initialize" GodotARVRInterface (IO Bool) where
        runMethod cls
          = withVariantArray []
              (\ (arrPtr, len) ->
                 godot_method_bind_call bindARVRInterface_initialize (coerce cls)
                   arrPtr
                   len
                   >>= \ (err, res) -> throwIfErr err >> fromGodotVariant res)

just wraps a call to (in psuedo-code): godot_method_bind_call (godot_method_bind_get_method "ARVRInterface" "initialize") <OpenVRInterface>. I don't see what the issue could be here from godot-haskell (but I'm not its main author, so maybe I'm missing something). Maybe there's some sort of thread race condition going on?

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 4, 2019

I suspect there is some weird interaction between the two modules. We did have an issue some time ago where a return value would not be passed correctly from the module to Godot.

I am wondering if something similar is happening here.

Or - the Haskell module is compiled against a different and incompatible GDNative definition than the OpenVR module.

@BastiaanOlij any ideas?

@BastiaanOlij
Copy link
Member

One issue that we've had that should have been corrected has to do with a recent change in godot-cpp where all the bindings are now initialised in a single call (not a fan of this solution). This call happened when the first script was constructed through a gdns file.

Seeing our singleton gets created waaaaay before that it would result in calls into Godot before the bindings were setup.

If that is our problem check if godotengine/godot-cpp#327 is part of the build you're doing.

The other thing I've previously had problems with is that you need to specifically add bits=64 to the compile settings for godot-cpp to create the correct names for the files. That was on Windows though.

@georgewsinger
Copy link
Author

georgewsinger commented Nov 6, 2019

Using godot_openvr master master + reverting to godot-cpp master. By this I mean I clone the godot_openvr repo and run

cd godot-cpp
git checkout master
cd ..

before compiling as usual. This both gets past the godot-cpp launch error above and allows me to run the demo (w/o the strange Milkyway.png error). However, the demo only launches whenever I start it without a controller. If I launch the demo with a controller, or I launch the demo without a controller and then turn it on, I get the following godot-cpp runtime crash:

handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x43f60) [0x7f195cc48f60] (??:0)
[2] /home/george/Simula/bin/godot(godot_method_bind_ptrcall+0x2c) [0x159654b] (/home/george/Simula/build/godot/modules/gdnative/gdnative/gdnative.cpp:69)
[3] godot::Mesh::surface_set_material(long, godot::Ref<godot::Material>) (??:0)
[4] openvr_data::_load_render_model(openvr_data::model_mesh*) (??:0)
[5] openvr_data::process() (??:0)
[6] /home/george/godot_openvr_master/demo/addons/godot-openvr/bin/x11/libgodot_openvr.so(+0x10006e) [0x7f195128306e] (??:0)
[7] ARVRInterfaceGDNative::process() (/home/george/Simula/build/godot/modules/gdnative/arvr/arvr_interface_gdnative.cpp:212)
[8] ARVRServer::_process() (/home/george/Simula/build/godot/servers/arvr_server.cpp:352 (discriminator 2))
[9] VisualServerViewport::draw_viewports() (/home/george/Simula/build/godot/servers/visual/visual_server_viewport.cpp:252)
[10] VisualServerRaster::draw(bool, double) (/home/george/Simula/build/godot/servers/visual/visual_server_raster.cpp:107 (discriminator 2))
[11] VisualServerWrapMT::draw(bool, double) (/home/george/Simula/build/godot/servers/visual/visual_server_wrap_mt.cpp:104)
[12] Main::iteration() (/home/george/Simula/build/godot/main/main.cpp:1893)
[13] OS_X11::run() (/home/george/Simula/build/godot/platform/x11/os_x11.cpp:3006)
[14] /home/george/Simula/bin/godot(main+0xdc) [0x119e65e] (/home/george/Simula/build/godot/platform/x11/godot_x11.cpp:56)
[15] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7f195cc2bb6b] (??:0)
[16] /home/george/Simula/bin/godot(_start+0x2a) [0x119e4ca] (??:?)

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 6, 2019

Yeah that looks like the crash that was present during the rewrite to godot-cpp, and was later solved, as far as I know.

I suspect either the index of the material is wrong or the material is not loaded yet - or correctly. Let me see if I can reproduce this somehow (I did update my branches to current master + what godot-cpp version was linked there on Monday).

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 10, 2019

ok so that crash happens because surface_set_material() does not exist in Godot 3.1. It does in the beta of Godot 3.2 and no crash there.

But, the .so I compiled that is still in master of GodotVR will work on Godot 3.1, as it is an older build without that function - and no crashes.

So I see two options:

  1. Update Simula to Godot 3.2 seeing it's in beta and should be out soon
  2. Use the .so that still is not updated in GodotVR master (but I think that clashed somewhere else/with Haskell?)

@georgewsinger
Copy link
Author

georgewsinger commented Nov 10, 2019

Ok thanks -- this clarifies things a lot. I think I'm leaning towards option (1) right now, though the reason why we're updating godot-openvr is due to the HMD freeze issue (#55), which occurs for us (even with the latest godot-openvr).

@beniwtv
Copy link
Collaborator

beniwtv commented Nov 11, 2019

I'll try to look into that issue - just left a comment there.

@beniwtv
Copy link
Collaborator

beniwtv commented Aug 2, 2020

Hi there, this is a quite old issue now - can we consider this solved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants