Replies: 3 comments 8 replies
-
code:
When I do this, the displayed result does not change, only when the width and height of the window change, the displayed result is correct. |
Beta Was this translation helpful? Give feedback.
-
On my phone right now so just a quick reply - have a look at the
vsgdynamicstate example.
…On Thu, 12 Jun 2025, 07:52 couchpotato, ***@***.***> wrote:
code:
while (viewer->advanceToNextFrame())
{
if ((++frameCount % 500) == 0)
{
viewer->deviceWaitIdle();
struct SetPipelineStates : public vsg::Visitor
{
void apply(vsg::Object& obj)
{
//std::cout << "apply " << obj.className() << std::endl;
obj.traverse(*this);
}
void apply(vsg::BindGraphicsPipeline& bgp)
{
for (auto& it : bgp.pipeline->pipelineStates)
{
it->accept(*this);
}
}
void apply(vsg::RasterizationState& rs)
{
rs.polygonMode = (VkPolygonMode)((rs.polygonMode+1)%3);
}
};
SetPipelineStates setPipelineStates;
sceneGraph->accept(setPipelineStates);
auto result = viewer->compileManager->compile(sceneGraph);
assert(result.result == VK_SUCCESS);
vsg::updateViewer(*viewer, result);
}
viewer->handleEvents();
viewer->update();
viewer->recordAndSubmit();
viewer->present();
}
When I do this, the displayed result does not change, only when the width
and height of the window change, the displayed result is correct.
—
Reply to this email directly, view it on GitHub
<#1493 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKEGUFLU7RS3ZC2YF6CUY33DEPRHAVCNFSM6AAAAAB7EDZI6KVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGNBUGIZDOMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: <vsg-dev/VulkanSceneGraph/repo-discussions/1493/comments/13442270@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
I'm afraid I'm too busy right now to dive deep into a topic and I have a lot of work to get completed. This area is one that OpenGL is much easier to manage state than Vulkan so it's a bit more awkward as Vulkan is written with static state as it's foundation, as you are are finding out sometimes requires extensions to get the extra control you need. From a quick review it looks like you are on the right track. The VSG could do with vsg::SetPolygonMode implementation and what you've written on first pass looks generally the right thing to do. Not all drivers will support this extension so have a look at what extensions are supported using a tool like vkinfo or the 'vsgdeviceselection --extensions' example. You'll need to pass the DynamicState settings to the loader as custom ShaderSet so that the loaders know to use it. The vsgshadow example has that sets the ShaderSet::defaultGraphicsPipelineStates to inject a pipeline state, not exactly what you want but might help point you in the right direction. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, the scene graph contains N nodes, and I want to switch the POLYGON_MODE of all nodes. How can I do it? One way is to recreate a pipeline for each node, but nodes will be added or removed dynamically. It feels very troublesome. There is this class StateSetManipulator in osg that can achieve this. I looked at it and it only changed the State of the top-level Camera in the Viewer.
Beta Was this translation helpful? Give feedback.
All reactions