isl-org / isl-org/Open3D

How to use gui with C++ api.

Open
#5,064 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### My Question

Hello, I am trying to create a window with gui using c++ api. This is my code (I have no idea if it is correct, because I couldn't find any examples).

```cpp
#include
#include
#include
#include

#include "open3d/Open3D.h"

int main(int argc, const char *argv[]) {
auto &app = open3d::visualization::gui::Application::GetInstance();
app.Initialize();

auto window =
std::make_shared("??", 1280, 720);

auto button = std::make_shared("a");
button->SetText("this is text");
window->AddChild(button);

app.AddWindow(window);
app.Run();

return 0;
}
```

I am getting the following error
```
terminate called after throwing an instance of 'std::runtime_error'
what(): [Open3D Error] (void open3d::visualization::gui::Application::Initialize(const char*)) /home/sebastian/lab/Open3D/cpp/open3d/visualization/gui/Application.cpp:305: Resource directory does not have Open3D resources: /home/sebastian/projects/open3d/resources

Aborted (core dumped)
```

Do you have any suggestions?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.