JoshuaBrookover / bigg

bgfx, imgui, glfw, glm
The Unlicense
226 stars 35 forks source link

initializing width/height for the first call to Application::reset #1

Closed onqtam closed 7 years ago

onqtam commented 7 years ago

Application::reset() is getting called twice in native builds - when initializing and on the first time update() is called (because glfwGetWindowSize() returns the proper values and when compared to the uninitialized ones they are different). The first time the width/height are garbage values and are passed to bgfx::reset() but the second call fixes that.

This was a problem when building the example with emscripten for asm.js - took me a few hours to figure out why after bgfx::init() was successful my canvas disappeared.

JoshuaBrookover commented 7 years ago

Thanks! This works with emscripten?

onqtam commented 7 years ago

not directly, but after integrating a call to emscripten_set_main_loop and ifdef-ing some glfw calls it worked.

I decided to go with the setup code from bigg instead of the one from the examples of bgfx (entry/input/utils/etc.) because after playing with and evaluating it for 2 days I decided it was too much baggage. So thanks for this!

JoshuaBrookover commented 7 years ago

You're welcome. Are you actually making use of this library? I was thinking about pushing some changes. I want to rename it from "bigg" since it's too close to "bimg," and while I was at it I wanted to remove glm (since I don't actually make use of it, I just added it for my own convenience).

Also I think the actual glue code between the libraries could be extracted out a bit more so that you didn't have to use my base application class. My intention was for this code to be as non-intrusive as possible, but I'm not sure how feasible that is just yet.

https://github.com/JoshuaBrookover/bigg/tree/gib

onqtam commented 7 years ago

I used it as a starting point and I rewrote the classes to fit "my perfect view" of how things should be done :D