You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy [SurfaceHelper.mm](https://github.com/DiligentGraphics/DiligentSamples/blob/master/Samples/GLFWDemo/src/SurfaceHelper.mm) file from the GLFW sample into your project.
@@ -157,9 +171,8 @@ Follow the [official documentation for setting up an android project](https://gi
157
171
158
172
### Building Diligent Engine separately
159
173
160
-
The following is a very rough guide of building Diligent separately to then be used in your own project.
161
-
162
174
Build Diligent Engine using CMake with an official NDK toolchain:
175
+
163
176
```bash
164
177
mkdir DiligentEngine_android_build
165
178
cd DiligentEngine_android_build
@@ -179,7 +192,10 @@ cmake -G"Ninja" \
179
192
ninja -j9
180
193
```
181
194
182
-
Setup your build system to be able to find the interface headers and built libraries. Here the variables `DILIGENT_PATH` and `DILIGENT_BUILD_PATH` refer to the locations of your root DiligentEngine repo copy and your build folder respectively.
195
+
Setup your build system to be able to find the interface headers and built libraries
196
+
Here the variables `DILIGENT_PATH` and `DILIGENT_BUILD_PATH` refer to the locations of your root
197
+
DiligentEngine repo copy and your build folder respectively.
198
+
183
199
```cmake
184
200
target_include_directories(app
185
201
PRIVATE
@@ -262,11 +278,13 @@ target_link_libraries(app
262
278
### Vulkan
263
279
264
280
Set the Vulkan and fullscreen / resizable window flags when creating the window.
When the app goes out of focus, destroy the swapchain
300
+
When the app goes out of focus, destroy the swapchain:
301
+
283
302
```cpp
284
303
if (device->GetDeviceInfo().IsVulkanDevice()) {
285
304
swapchain.Release();
286
305
device->IdleGPU();
287
306
}
288
307
```
289
308
290
-
When the app regains focus, create the swapchain again
309
+
When the app regains focus, create the swapchain again:
310
+
291
311
```cpp
292
312
if (device->GetDeviceInfo().IsVulkanDevice())
293
313
{
@@ -303,7 +323,9 @@ if (device->GetDeviceInfo().IsVulkanDevice())
303
323
304
324
### OpenGLES
305
325
306
-
Set the attributes Diligent expects, set the OpenGL and fullscreen / resizable window flags, create the window, create the context, and finally create the swapchain
326
+
Set the attributes Diligent expects, set the OpenGL and fullscreen / resizable window flags, create the window, create the context,
327
+
and finally create the swapchain:
328
+
307
329
```cpp
308
330
constauto color_size = 8;
309
331
constauto depth_size = 24;
@@ -332,15 +354,17 @@ auto gl_context = SDL_GL_CreateContext(window);
332
354
// ...
333
355
```
334
356
335
-
When focus is lost, call suspend on the swapchain
357
+
When focus is lost, call suspend on the swapchain:
When focus is resumed, call resume on the swapchain (Native window pointer not required)
366
+
When focus is resumed, call resume on the swapchain (Native window pointer is not required):
367
+
344
368
```cpp
345
369
if (device->GetDeviceInfo().IsGLDevice())
346
370
{
@@ -355,12 +379,18 @@ if (device->GetDeviceInfo().IsGLDevice())
355
379
-`SDL_GetDisplayMode()` can be used to determine max resolution.
356
380
357
381
## ImGui
382
+
358
383
### Compiling and Linking
359
-
Whatever is most convenient for your build system, compile and link [imgui_impl_sdl.cpp](https://github.com/DiligentGraphics/imgui/blob/66ad2ad5398cb61433009553e10fd326d13acb84/backends/imgui_impl_sdl.cpp) into your project
384
+
385
+
Add [imgui_impl_sdl.cpp](https://github.com/DiligentGraphics/imgui/blob/66ad2ad5398cb61433009553e10fd326d13acb84/backends/imgui_impl_sdl.cpp) to your project
360
386
361
387
### Using the ImGuiImplSDL implementation
388
+
362
389
#### Setup
363
-
Add the [ImGuiImplSDL.hpp](https://github.com/DiligentGraphics/DiligentTools/blob/fbd6c1054744724387e37ae69b1636782f703ca0/Imgui/interface/ImGuiImplSDL.hpp) header included in Diligent. After creating the swapchain, call `ImGuiImplSDL::Create(CI, sdl_window)` and store the result for usage as normal
390
+
391
+
Include the [ImGuiImplSDL.hpp](https://github.com/DiligentGraphics/DiligentTools/blob/master/Imgui/interface/ImGuiImplSDL.hpp) header.
392
+
After creating the swapchain, call `ImGuiImplSDL::Create(CI, sdl_window)` and store the result to be used as normal:
0 commit comments