Thanks for this Go wrapper, it is awesome.
I am trying to change the drawing logic in order to achieve better performance in a simple desktop application. I would like to limit the GL draw calls to actual user interactions or render buffer changes. In the c nuklear documentation I see that it is possible by defining NK_ZERO_COMMAND_MEMORY and by comparing the last draw commands with the new ones, using memcmp and memcpy.
Here's my attempt at it, by modifying impl_glfw_gl3.go:
And finally, the comparison and copy in the NkPlatformRender function:
gl.UnmapBuffer(gl.ARRAY_BUFFER)
gl.UnmapBuffer(gl.ARRAY_BUFFER)
gl.UnmapBuffer(gl.ELEMENT_ARRAY_BUFFER)
if memcmp(dev.cmds, dev.lastCmds, state.ctx.memory.allocated) != 0 {
memcpy(dev.lastCmds, dev.cmds, state.ctx.memory.allocated)
var offset uintptr
// iterate over and execute each draw command
NkDrawForeach(state.ctx, dev.cmds, func(cmd *DrawCommand) {
....
Unfortunately this doesn't look to work on the demo application... all I see is a blue background (the default color). I tried to debug and memcmp returns -1 only the first time, then always 0... weird.
Thanks for this Go wrapper, it is awesome. I am trying to change the drawing logic in order to achieve better performance in a simple desktop application. I would like to limit the GL draw calls to actual user interactions or render buffer changes. In the c nuklear documentation I see that it is possible by defining
NK_ZERO_COMMAND_MEMORY
and by comparing the last draw commands with the new ones, usingmemcmp
andmemcpy
.Here's my attempt at it, by modifying
impl_glfw_gl3.go
:NK_ZERO_COMMAND_MEMORY
definition:memcmp
andmemcpy
wrappers:Definition of a buffer for the last frame commands:
Initialization:
And finally, the comparison and copy in the
NkPlatformRender
function:Unfortunately this doesn't look to work on the demo application... all I see is a blue background (the default color). I tried to debug and
memcmp
returns-1
only the first time, then always0
... weird.Any thought about this attempt?