New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create multiple instances #34
Comments
Hi! Does it work if you change it to?
I ask because you may encounter more issues later as I never tried more than one manager. If that doesn't work then try:
Btw although I created Colibri thinking it could be used to render more than 1 GUI with the same ColibriManager, I never really explored that idea and there are a few caveats:
|
So yes that is how I fixed the datablock issue. I then thought it would be just a case 'fudging' the Colibrigui custom pass and pass provider. Sadly its seems much more complicated as when that is setup is asserts and crashes later here; I will have a closer look at it tomorrow. |
Actually it sounds like ColibriManager::prepareRenderCommands is getting called twice for the same manager instead of one per manager (which would make it a custom pass provider issue) Check the value of 'this' for the calls |
So the previous issue was caused by update not being called on the second instance. However with that sorted, 1 instance has corrupted text, and the other renders nearly nothing. (blue window is first instance, red windows is 2nd instance) My colleague, who is not that familiar with Ogre, is actually working on this task. So I might have to have a closer look at this at a later stage, although I did notice that the HLMSCache was a static variable which seemed odd. |
- m_defaultTextDatablock must only be created once - HlmsColibri must have the proper glyph atlas otherwise the characters will be rendered as if they're corrupted. Ideally ShaperManagers should be shared between ColibriManagers for maximum effciency
Ok I took a look at your code. You started off with 2 windows which makes it harder. You should've started with two RenderTextures and render those into a single window. That takes away the pain of dealing with two Windows (also SDL and Ogre are fighting due to the hacky way the windows are created). Anyways the corrupt text problem seems to be fixed. HLMSCache being static should remain static. It's only a stub pointer because apiObjects.lastHlmsCache must not be nullptr. i.e. The 2nd window is rendering something... but then NaNs are taking over. For some reason |
OK Mystery solved. The 2nd window was rendering fine. It was user error. You were not calling |
This issue seems to be fixed now thus I'm closing it PS. your code in OpenGL isn't working due to this issue. |
colibrigui/src/ColibriGui/ColibriManager.cpp
Line 187 in 5f01565
I would like to create multiple GUI's to offscreen render targets, but this line prevents me from creating multiple instances of the ColibriManager. Just needs a check to see if datablock already exists
The text was updated successfully, but these errors were encountered: