jdryg / vg-renderer

A vector graphics renderer for bgfx, based on ideas from NanoVG and ImDrawList (Dear ImGUI)
BSD 2-Clause "Simplified" License
504 stars 55 forks source link

"../memory/allocator.h" missing #2

Closed raizam closed 7 years ago

raizam commented 7 years ago

Hi, @bkaradzic brought me here :+1: :+1: please I would need that allocator.h file. thanks

raizam commented 7 years ago

../memory/fixed_size_pool.h also please

jdryg commented 7 years ago

Hi,

You don't actually need those. allocator.h is a small wrapper around bx::AllocatorI with optional tracing (which part of the code allocated how much memory and when it was freed).

fixed_size_pool.h is a... fixed-size pool, which isn't needed (actually I don't use it anymore but it was left there because I haven't touched NanoVG in a while). If you follow the code in bgfxvg_renderer.cpp, the same fixed-size pool has been implemented inside vg::Context (https://github.com/jdryg/vg-renderer/blob/master/src/vg/bgfxvg_renderer.cpp#L220)

I'll try to clean up the code, not to use those files, and reupload.

Btw, if you just want to try out vg-renderer you should be looking at vg::BGFXVGRenderer. vg::NanoVGRenderer is there only to help comparing the two.

jdryg commented 7 years ago

Added some preprocessor conditions around those includes and inlined FixedSizePool like in bgfxvg_renderer.cpp.

Unless I'm forgetting something the only external file you need now is a Vec2 struct with a couple of operators for bgfxvg_renderer.cpp. Should be easy to write. If you have any other questions or requests feel free to ask.

raizam commented 7 years ago

Thank you very much for your changes, I have implemented a Vec2 class and needed math functions that seems to fit the need: https://gist.github.com/raizam/29fa7bcf127e6b36fc076c14c77d3d40

Now I have one last problem:

'vs_solid_color_spv': undeclared identifier bgfxvg_renderer.cpp L84 'vs_gradient_spv': undeclared identifier bgfxvg_renderer.cpp L86

so I understand that BGFX now expects a shader binary of type "spv". mmm

jdryg commented 7 years ago

Try pulling latest commit. Should be fixed now.

raizam commented 7 years ago

Alright, I got it compiled, and it is working fine :) Now I guess I have to implement a C wrapper around IRenderer, so I can test it from my c# app. Thank you for your valuable work

raizam commented 7 years ago

So I got a wrapper ready on top of IRenderer.

NanoVGRenderer seems to work fine, or at least it draws rectangles. while BGFXVGRenderer isn't drawing anything.

Maybe my Vec2 implementation has something wrong, looks fine to me. :https://gist.github.com/raizam/29fa7bcf127e6b36fc076c14c77d3d40

not sure what to do =)

raizam commented 7 years ago

finally got the rectangles working using BGFXVGRenderer. the viewId assigned wasn't initialized properly. It is fast indeed! cheers

jdryg commented 7 years ago

Glad to hear you managed to figure it out. :+1: