sbarisic / NuklearDotNet

.NET binding for the Nuklear immediate mode GUI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method like "GetSubMeshCount()" missing.

DaEgi01 opened this issue · comments

commented

I tried to integrate this lib into unity 5.6.
I am currently working with Submeshes and Graphics.DrawMesh.
What I need is a way to know, how many objects are generated from the vertices in vertexBuffer, before the Render Methods are called for each.

You are better off using the GL class it's more low level and you can pretty much just copy-paste the SFML example. The Render method is gonna called for each mesh. The Count parameter tells how many vertexes the mesh has.

commented

But the counter is available right and could in theory be exposed?
Graphics.DrawMesh also works fine, I see the UI there. My issue is just that I have hardcoded the submeshCount for now.
It could be an additional parameter of the SetBuffer method maybe?
Anyway, its up to you. I ll try the GL class instead. Thx.

Exposed how and where exactly? If you're creating your own device, then as @Donaut said, you get the vertex count in the Render() method.

Nuklear has some sort of "command buffer" in the background, which basically says "draw a mesh with X clip rectangle and Y assigned texture" and gives you the offset and count into a vertex/index array, which can be drawn multiple times. The SetBuffer method is just there for you to keep track of vertices/indices combo to be used in the Render method.

Therefore it's okay to recreate all the graphics objects you are going to use in the Render method, because that can be cached, and RenderFinal would get called every frame to do the actual drawing.