You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, I'm learning bgfx and trying to integrate nuklear gui library into my project.
In nk_sdl_device_create function I initialize nuklear and create bgfx resources (vertex declation, buffers and font atlas texture).
The file where I'm rendering mesh generated by nuklear is here https://github.com/VladSerhiienko/FbxPipeline/blob/master/FbxPipeline/FbxViewer/NuklearSdlBgfx.cpp in nk_sdl_render function.
I made the shader very trivial gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); and I expect to see some red rects. I see none. I printed debug stats and checked via renderdoc, the problem is there were no draw calls made.
I need help on this issue, I'm sure there is smth very trivial I'm missing in the code, here is what i do in nk_sdl_render :
bgfx::setViewRect( 0, 0, 0, display_width, display_height );
bgfx::setState( BGFX_STATE_RGB_WRITE | BGFX_STATE_ALPHA_WRITE | BGFX_STATE_BLEND_EQUATION_ADD |
BGFX_STATE_BLEND_FUNC( BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA ) );
....
// I checked if the vertices and indices are ok, they are ok
bgfx::updateDynamicVertexBuffer(dev->vertexBufferHandle, 0, fbxv::bgfxUtils::makeReleasableRef( sdl.ogl.vertexBuffer.memory.ptr, sdl.ogl.vertexBuffer.allocated ) );
bgfx::updateDynamicIndexBuffer(dev->elementBufferHandle, 0, fbxv::bgfxUtils::makeReleasableRef( sdl.ogl.elementBuffer.memory.ptr, sdl.ogl.elementBuffer.allocated ) );
...
// Then in the loop for each command I do:
bgfx::setScissor( ( GLint )( cmd->clip_rect.x * scale.x ),
( GLint )( ( height - ( GLint )( cmd->clip_rect.y + cmd->clip_rect.h ) ) * scale.y ),
( GLint )( cmd->clip_rect.w * scale.x ),
( GLint )( cmd->clip_rect.h * scale.y ) );
auto &textureHandle = *(bgfx::TextureHandle *) cmd->texture.ptr;
bgfx::setTexture( 0, dev->textureUniformHandle, textureHandle );
bgfx::setViewTransform( 0, view, ortho );
bgfx::setVertexBuffer( dev->vertexBufferHandle );
bgfx::setIndexBuffer( dev->elementBufferHandle, offset, cmd->elem_count );
drawcallCount += bgfx::submit( 0, dev->textureProgramHandle );
offset += cmd->elem_count;
Currently, I'm learning bgfx and trying to integrate nuklear gui library into my project.
In
nk_sdl_device_create
function I initialize nuklear and create bgfx resources (vertex declation, buffers and font atlas texture).The file where I'm rendering mesh generated by nuklear is here
https://github.com/VladSerhiienko/FbxPipeline/blob/master/FbxPipeline/FbxViewer/NuklearSdlBgfx.cpp in
nk_sdl_render
function.I made the shader very trivial
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
and I expect to see some red rects. I see none. I printed debug stats and checked via renderdoc, the problem is there were no draw calls made.I need help on this issue, I'm sure there is smth very trivial I'm missing in the code, here is what i do in
nk_sdl_render
:I took the code from the nuklear sdl3 demo here https://github.com/vurtun/nuklear/blob/master/demo/sdl_opengl3/nuklear_sdl_gl3.h
The text was updated successfully, but these errors were encountered: