floooh / oryol-samples

Oryol extension module samples
MIT License
82 stars 16 forks source link

Update Nuklear samples based on changes on nuklear api #15

Closed joeld42 closed 5 years ago

joeld42 commented 5 years ago

Updates to the NuklearBasic and NuklearAdvanced samples to reflect the recent changes in nuklear api, to go along with the PR for oryol-nuklear.

floooh commented 5 years ago

CI has failed because the oryol-nuklear project wasn't merged yet. I'll merge anyway, and if there are remaining problems (e.g. on different compilers), I'll try to fix them during the day.

floooh commented 5 years ago

Hmm... I had to update fips-nuklear to the latest Nuklear version (naturally), and now I'm getting asserts in Nuklear when clicking on certain things in the NuklearBasic sample, and in the NuklearAdvanced sample I'm getting a validation error in Metal:

validateIndexBuffer:133: failed assertion `indexCount(0) must be non-zero.'

(something is trying to be rendered with indexed rendering, but no indices are provided in the buffer). Apparently Nuklear generates "empty" rendering commands where the elem_count in the draw command is zero. I'll put a check around that for now to ignore those warnings...

floooh commented 5 years ago

Btw I also changed the location of the fips-nuklear in oryol-nuklear to the fips-libs organization (github.com/fips-libs/fips-nuklear, instead of github.com/floooh/fips-nuklear).

floooh commented 5 years ago

This is the assert I'm getting in the NuklearBasic example, don't know what element I clicked though:

*** ORYOL ASSERT: layout->row.type == NK_LAYOUT_STATIC_ROW || layout->row.type == NK_LAYOUT_DYNAMIC_ROW
  msg=none
  file=/Users/floh/projects/fips-nuklear/nuklear/nuklear.h
  line=17657
  func=void nk_layout_row_end(struct nk_context *)
  callstack:
0   NuklearUIBasic                      0x0000000100097ac6 _ZN5Oryol10StackTrace4DumpEPci + 70
1   NuklearUIBasic                      0x0000000100093786 _ZN5Oryol3Log9AssertMsgEPKcS2_S2_iS2_ + 182
2   NuklearUIBasic                      0x0000000100055ffb nk_layout_row_end + 363
3   NuklearUIBasic                      0x0000000100007b39 _ZN7DemoApp18drawOverviewWindowEP10nk_context + 11849
4   NuklearUIBasic                      0x0000000100004cb3 _ZN7DemoApp9OnRunningEv + 35
5   NuklearUIBasic                      0x00000001000907a1 _ZN5Oryol3App7onFrameEv + 401
6   NuklearUIBasic                      0x000000010009bc01 _ZN5Oryol5_priv9osxBridge7onFrameEv + 97
7   NuklearUIBasic                      0x000000010009bb54 -[oryolViewDelegate drawInMTKView:] + 68
8   MetalKit                            0x00007fff39b863be -[MTKView draw] + 277
9   MetalKit                            0x00007fff39b82e12 __23-[MTKView __initCommon]_block_invoke + 42
10  libdispatch.dylib                   0x000000010062b7f3 _dispatch_client_callout + 8
11  libdispatch.dylib                   0x000000010062ebfd _dispatch_continuation_pop + 576
12  libdispatch.dylib                   0x000000010064352e _dispatch_source_invoke + 2109
13  libdispatch.dylib                   0x000000010063a1cf _dispatch_main_queue_callback_4CF + 1412
14  CoreFoundation                      0x00007fff34f16147 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15  CoreFoundation                      0x00007fff34f15856 __CFRunLoopRun + 2335
16  CoreFoundation                      0x00007fff34f14ce4 CFRunLoopRunSpecific + 463
17  HIToolbox                           0x00007fff341ae895 RunCurrentEventLoopInMode + 293
18  HIToolbox                           0x00007fff341ae5cb ReceiveNextEventCommon + 618
19  HIToolbox                           0x00007fff341ae348 _BlockUntilNextEventMatchingListInModeWithFilter + 64
20  AppKit                              0x00007fff3246b8bb _DPSNextEvent + 997
21  AppKit                              0x00007fff3246a65a -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
22  AppKit                              0x00007fff324646bd -[NSApplication run] + 699
23  NuklearUIBasic                      0x000000010009dc52 _ZN5Oryol5_priv9osxBridge13startMainLoopEv + 258
24  NuklearUIBasic                      0x00000001000903a2 _ZN5Oryol3App13StartMainLoopEv + 114
25  NuklearUIBasic                      0x00000001000048db main + 91
26  libdyld.dylib                       0x00007fff61eea0a1 start + 1
27  ???                                 0x0000000000000001 0x0 + 1

(lldb) 
floooh commented 5 years ago

Alright, OSX and Linux are compiling, but the usual float-int-conversion problems on Visual Studio in new code (see https://ci.appveyor.com/project/floooh/oryol-samples#L836) , I'll look at it in a few hours when I have access to a Windows machine.

floooh commented 5 years ago

Hmm ok I fixed the Nuklear compile problems in Visual Sutdio, but while doing that I noticed that the API seems to have changed in such subtle ways that the samples are probably still broken (e.g. RGB colors seemed to be integers from 0..255 previously, but now float values).

I'm currently thinking about removing the Nuklear and Turbobadger samples from the oryol-samples, and only keep the ImGui samples in, since I haven't kept track of changes in TBUI and Nuklear but focused on Dear Imgui instead.

joeld42 commented 5 years ago

You might want to move TBUI and Nuklear out into a separate UI sample, I think they are still useful because Imgui is not well suited for in-game UI since it doesn't support theming with images. In my project I'm using both Dear Imgui for tools and debug UI, and Nuklear for in-game UI. I think virtun has mostly stopped development on nuklear and is just making bugfixes now so I don't think that other api-breaking changes are likely. I'll take another look at the colors in oryol-samples and there were some other sizing changes that might affect the sample.

On Tue, Sep 11, 2018 at 6:57 AM Andre Weissflog notifications@github.com wrote:

Hmm ok I fixed the Nuklear compile problems in Visual Sutdio, but while doing that I noticed that the API seems to have changed in such subtle ways that the samples are probably still broken (e.g. RGB colors seemed to be integers from 0..255 previously, but now float values).

I'm currently thinking about removing the Nuklear and Turbobadger samples from the oryol-samples, and only keep the ImGui samples in, since I haven't kept track of changes in TBUI and Nuklear but focused on Dear Imgui instead.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/floooh/oryol-samples/pull/15#issuecomment-420283685, or mute the thread https://github.com/notifications/unsubscribe-auth/AABgsPCtFQo3YNNZ5GKt1CiPYDVaotLJks5uZ8E5gaJpZM4WimpY .

floooh commented 5 years ago

Maybe it makes sense to move the Nuklear and TBUI samples into the oryol-nuklear and oryol-turbobader projects... I'll think about it! Will take some time though.