fruxo / turbobadger

Small footprint UI library for hardware accelerated games & applications
582 stars 85 forks source link

Submitting renderbatches to custom OpenGL renderer #56

Open faizol opened 8 years ago

faizol commented 8 years ago

Hi,

I'm trying to integrate TurboBadger with my application that uses a custom OpenGL render batches. The pseudo format for the custom render batches is as the following; RenderBatch(destination rect, source UV rect, GLuint GL texture id, depth float);

From what I understand, TB would generate a texture atlas for all the loaded texture resources before binding it to OpenGL. My question is, how can I get the source UV rect from the texture atlas so that I can supply that to the custom render batcher above?

Also, as TB is a good GUI library, is there any plan for a simple beginner tutorial probably using glut to highlight best practices using TB, as that could help those whom are interested in using the GUI lib?

Thanks.

fruxo commented 8 years ago

If you subclass TBRendererBatcher, that information is already lost but the only thing you need to implement is flushing triangles directly from the {x, y, u, v, color} vertex array.

If you have no way to render that for some reason, you'll have to subclass TBRenderer instead. Like TBRendererBatcher, you can then generate any output you want (you'll get the atlas source rects from TBBitmapFragment).

Regarding beginner tutorial: I get lots of requests for beginners tutorials, especially for integrating with SDL. I have too little time to do it though.

faizol commented 8 years ago

Hi fruxo, I got the basic rendering working. Is there a plan for a forum or at least a wiki entry for Turbo Badger? This is a good GUI library and having a wiki or something to help other users with basic tutorials would be extremely helpful to build community around Turbo Badger. I think active community involvement will also be extremely helpful in porting this GUI library to Vulkan should there is a need to do so.

Cheers,