[osg-users] Shadow Shenanigans (Implementing shadows in OpenMW and associated experiments)

2017-09-20 Thread Chris Djali
Hi, I'm currently in the process of trying to make shadows work in OpenMW and am therefore trying to learn about osgShadow and also convince it to do a bunch of things. I have several questions, so I'll try and organise them nicely with bullet points and subheadings etc. In case it affects

Re: [osg-users] osgViewer::Viewer fullscreen dual monitor issue

2017-09-12 Thread Chris Djali
I'm having a similar issue but under slightly different circumstances. Unlike the original author of this thread, my leftmost monitor shows as having the lower index. Is there anything I can do about this? -- Read this topic online here:

Re: [osg-users] EditorConfig file?

2019-04-02 Thread Chris Djali
kornerr wrote: > Hi, Chris, > > just create EditorConfig and share it. Those who are interested will > follow you.Don't wait for us to want your thing. Just do the thing, > show it and explain its benefits. > You're not alone, we're here, but you lead EditorConfig initiative, not us. > >

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-03-29 Thread Chris Djali
All out of the 3.6 branch, 3.4.1 and OpenMW's 3.4.1 fork (which doesn't make any changes to osgText, and we're trying to abandon, but it's much faster than the official 3.4.1 release). If everything's working as we think it does, OpenMW should work with any OSG release after 3.4. The issue of

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-03-28 Thread Chris Djali
The problem is specifically because it's static. Unless I'm manually keeping track of when the last text object is removed from the scene, I can't release the program without it potentially still being in use. If I never release it, references to it can persist beyond the lifetime of the

Re: [osg-users] EditorConfig file?

2019-04-01 Thread Chris Djali
Hi, It's been a couple of weeks, and I've not had any response about any official policy on indentation in the case of existing files that already break the global rule. Should I just go for the stance of "it's supposed to be spaces for everything except for files that are already entirely

Re: [osg-users] EditorConfig file?

2019-03-14 Thread Chris Djali
I'm fine making the pull request. I'd just like confirmation of exactly what the whitespace conventions are - I wouldn't want to set it to use four spaces for indentation for everything and then find out later that the CMake files use tabs or anything like that. The main rules are listed here:

Re: [osg-users] EditorConfig file?

2019-03-14 Thread Chris Djali
I just grepped the repo for tabs just in case, and found that that's not entirely accurate. There are a few files where tabs have snuck into otherwise space-indented files (which is fine - adding an editorconfig file won't meddle with existing stuff until someone edits that line), but it looks

Re: [osg-users] osgQt doesn't set a context ID

2019-03-19 Thread Chris Djali
The problem was definitely user error - parts of the scene graph were being removed before OSG had had a chance to clean up. Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=75723#75723

[osg-users] Removing objects with shared GL state from scene graph

2019-03-20 Thread Chris Djali
Hi, I know that when an OpenGL context is destroyed, the associated viewer can only call releaseGLObjects(osg::State *) for nodes still attached to the scene graph, so if you're removing things before that, you're manually supposed to call releaseGLObjects on the subgraph. However, as I see

Re: [osg-users] osgQt doesn't set a context ID

2019-03-19 Thread Chris Djali
I've been informed that I was wrong about this. While I am seeing issues with my application, the context ID is actually being set, just it's being set to the same value as the previous context as OSG reuses IDs for dead contexts. What I know about the issue so far is that the per-context

[osg-users] osgQt doesn't set a context ID

2019-03-12 Thread Chris Djali
Hi, For context, this discussion is about the OpenMW CS tool, the source of which is available here: https://gitlab.com/OpenMW/openmw/tree/master/apps/opencs. I've kind of inherited maintenance responsibilities for the graphical parts of this without necessarily knowing much of how it works.

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-04-12 Thread Chris Djali
Hi, It's been a couple of weeks since the last reply to this. I'm guessing this has fallen off the radar, but I still need to fix the issue, so would appreciate if another look could be taken at this. Thank you! Cheers, Chris -- Read this topic online here:

Re: [osg-users] EditorConfig file?

2019-04-12 Thread Chris Djali
Hi, Here's a list by file extension of which indentation styles are used. Annoyingly, a lot of the file extensions that always have tabs somewhere often have spaces, too, so it's not quite as simple as declaring all .java files use tabs (although I'm assuming they all used tabs when they were

Re: [osg-users] EditorConfig file?

2019-04-15 Thread Chris Djali
at GitHub, I would > recommend re-raising this issue and creating a pull request. > > Regards, > Michael. > > On Fri, 12 Apr 2019 at 21:27, Chris Djali <> wrote: > > > > > Hi, > > > > Here's a list by file extension of which indentation style

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-04-16 Thread Chris Djali
Hi, The following basically simulates the use case that's causing problems. Code: #include #include #include #include #include #include #include /** A representation of something that gets edited. * Pretend it's actually more complicated than this so that reference counting the

[osg-users] EditorConfig file?

2019-03-13 Thread Chris Djali
Hi, I just noticed (when looking at a local modification and realising my IDE had added tabs to a file using spaces) that the OSG repo doesn't contain an EditorConfig file. This is basically a file that instructs IDEs and editors of a project's whitespace style, overriding the user's settings

Re: [osg-users] Layered rendering with a geometry shader

2019-05-15 Thread Chris Djali
Thanks Voerman. I'd looked through the examples for other things, but not for multiple viewports, so missed that. It seems to be a good starting point once I switched the GLSL extension from the NV variant to the ARB one. Despite not being core until OpenGL 4.1, it looks like multiple viewports

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-05-15 Thread Chris Djali
Hi, It looks like this has fallen off the radar again as it's been a month. I'd still rather fix this in a robust way rather than making a guess as to the most sensible approach and creating maintenance problems down the line. Thank you! Cheers, Chris -- Read this topic

Re: [osg-users] osgText::Text dissapears when reparent container window on qt

2019-06-23 Thread Chris Djali
When the widget is popped out, it causes the creation of a new OpenGL context. I see that you've told Qt to share things between the old and new context, which means you'll still be able to use some things in the new one, but I'd look into what can and can't be shared as it isn't everything.

[osg-users] Layered rendering with a geometry shader

2019-05-14 Thread Chris Djali
Hi, I'm investigating using a geometry shader to render multiple shadow map cascades in one pass in OpenMW. While I've heard conflicting (but mostly negative) accounts of how much additional performance this can bring, I reckon it's likely to help, as OpenMW uses a ridiculous quantity of tiny

Re: [osg-users] Layered rendering with a geometry shader

2019-05-22 Thread Chris Djali
Hi, Most of my testing was with a ShapeDrawable with a sphere, and that uses quad strips. However, I've also tried it with some of OSG's test models, such as spaceship.osgt, and that specific example only uses triangles and is broken, too. Cheers, Chris -- Read this topic

Re: [osg-users] Layered rendering with a geometry shader

2019-05-20 Thread Chris Djali
Hi, I've been playing around with this, and have an annoying issue. On my machine, which runs Windows and has a Radeon Vega 56, using three viewports with geometry shader instancing makes some triangles go missing in the second and third viewports. This happens in my own application and in a

Re: [osg-users] Different views hide/show different nodes shared scene graph

2019-04-18 Thread Chris Djali
Hi, You should be able to dynamic_cast or asCullVisitor the arguments to a regular node callback to get a cull visitor pointer, and then from that, you can access the camera. You don't need to have a version with a boolean return value, either. Just don't traverse the node's children from the

Re: [osg-users] Convert .earth file to .osg format

2019-05-03 Thread Chris Djali
Hi, I think they're talking about the C preprocessor definition, FLT_MAX rather than anything specific to anything used here: https://www.tutorialspoint.com/c_standard_library/float_h.htm It's the maximum value of an IEEE 32-bit float. Cheers, Chris -- Read this topic online

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-03 Thread Chris Djali
Hi, Apparently, that approach won't work here - in my actual application, the multiple views are managed with a composite viewer, and that only calls its cleanup operation in its destructor and not when views are removed. I'll still be able to make something work, but it would have been nice

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-02 Thread Chris Djali
Hi, When the text node's releaseGLObjects is called, it calls the same method of: The GlyphQuads The Font (which is potentially problematic when it doesn't get skipped). The vertex attributes ( _coords, _normals, _colorCoords, _texcoords) The primitives in

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-03 Thread Chris Djali
Hi, Turns out that it's not a font in the object cache that's causing me grief after all, but instead the static default font here: https://github.com/openscenegraph/OpenSceneGraph/blob/OpenSceneGraph-3.6/src/osgText/Font.cpp#L40. This is initialised from a GLubyte array instead of a file, so

Re: [osg-users] osgposter through Task Scheduler

2019-07-03 Thread Chris Djali
Hi, I don't want to be the guy that says "Go away and Google your problem", but I was curious and searched for OpenGL on headless Windows and saw a few results where people had managed to do it. Even if you don't find something compatible with your situation, you're likely to find more and

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-02 Thread Chris Djali
Hi, This surprises me, but apparently clearing the object cache is enough to stop anything from leaking (otherwise, in the case where the second text node was removed, too, without releasing its GL objects, CodeXL was reporting two leaked shaders and three leaked program pipelines). I was

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-06-29 Thread Chris Djali
Hi, I've been putting off responding to the last post as I wanted to be sure I wasn't misunderstanding you, but after several rereadings, I still think you've missed my point. I'll try explaining the issue again, but I'm not sure which part isn't clear, so I don't know how much it'll help. In

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-01 Thread Chris Djali
Hi, I've only tested that example against the 3.6 branch (as of commit 4b6d9287, which was the latest yesterday), and while it doesn't actually crash or show errors, putting tracepoints in shows that the shader program is recompiled and the glyph texture is added to the orphaned list once the

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-06-30 Thread Chris Djali
Hi, Hopefully this example illustrates the underlying problem with osgText::Text::releaseGLObjects without the multiple viewer schenanigans in my previous example: Code: #include #include #include #include int main() { osgViewer::Viewer viewer; // Single-threaded mode so we

Re: [osg-users] Fixed pipeline lighting to shaders

2019-08-11 Thread Chris Djali
Hi, ShaderGen from 3D Labs is an old tool that can generate equivalent GLSL 1.2 shaders for a fairly large subset of FFP state. I've used it a fair amount to sanity-check things. If you just want a basic shader as a start point to drop into an FFP application, it's pretty good, but there are

Re: [osg-users] Shininess without Material

2019-08-11 Thread Chris Djali
Hi, Fixed-function materials can track either the material colour or the vertex colour depending on if glColorMaterial is used, so you can probably get the behaviour you want by setting a material on the stateset as before, but changing its mode so that (for example) the diffuse and ambient

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-08-19 Thread Chris Djali
Hi, Did my last message disappear because of the forum issues? It's been a while and there's no reply yet... Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76596#76596 ___ osg-users

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-08-20 Thread Chris Djali
Here it is again: AnyOldName3 wrote: > Hi, > > Hopefully, after that two-week hiatus, we can get this sorted. > > > > You can always subclass from Camera and override the destruct if you want > > to add this "fix" if it suits your usage case. > > > I'm already going to have to include a

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-09-03 Thread Chris Djali
Hi, It's been a week, so I'm just checking this hasn't been forgotten. Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76638#76638 ___ osg-users mailing list

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-08-25 Thread Chris Djali
Hi, I'm trying to build a stripped-down version of the same behaviour as my application, but it's got extra issues because things that are handled by what I'm stripping out aren't being handled when they're gone. What's the correct process for adding and removing views to and from an

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-08-25 Thread Chris Djali
Hi, The reason I couldn't add or remove views during the event traversal was that it was invalidating iterators that iterated over the views. Instead, I'm adding an update operation to add or remove the viewer. I now have a fairly minimal example that replicates my use case and bug: Code:

Re: [osg-users] Questions on optimizing my scene graph

2019-09-02 Thread Chris Djali
Hi, > Statusswitches are always costly. How does OSG identify if a texture or a > program is identical when > checking for status changes? Is it by comparing the pointers? If yes, it > is necessary to manage a pool > and use the same pointers everywhere? StateSet::compare takes an

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-08-21 Thread Chris Djali
Hi, Is the plan still to have OSG itself release GL objects in the object cache when the contexts they're associated with are destroyed, and if so, have you had any further thoughts about how this might be accomplished? The problem is still that there's nothing in osgViewer that has the same

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-08-23 Thread Chris Djali
Hi, As we've discussed, that only occasionally helps. In the boring single-viewer, single-view case, it works, but no one would notice there was a problem there anyway as nothing would actually render incorrectly. My application just uses the camera created for it by OSG when an

Re: [osg-users] Shadow Implement.

2019-09-10 Thread Chris Djali
Hi, You need to use shadow2D instead of texture2D to sample a sampler2DShadow in older GLSL versions. Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76668#76668 ___ osg-users mailing

Re: [osg-users] Shadow Implement.

2019-09-09 Thread Chris Djali
Hi, As someone who's added shadows to an OSG application, I can confidently say you're going to have a bad time if you try and use anything in osgShadow. I was told this before I'd really got started, and I didn't believe it, so continued anyway, and while I did end up with impressive final

Re: [osg-users] Geometry Shininess and Color Array

2019-09-15 Thread Chris Djali
Hi, Have you tried playing with osg::Material::setColorMode? It controls glColorMaterial settings, which is used to switch between having the material colour be determined by the global colour or vertex colours. You probably had the Material set to use its own colour, but if you re-add it and

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-26 Thread Chris Djali
Hi, > So... would change the destructor to: > > > Camera::~Camera() > { > setCameraThread(0); > > if (_graphicsContext.valid()) > > { >releaseGLObjects(_graphicsContext->getState()); > > > _graphicsContext->removeCamera(this); > } > else >

Re: [osg-users] Android: Survive Context Loss without complete reinitialization

2019-07-23 Thread Chris Djali
Hi, You can't release objects that belong to a destroyed context, so you definitely need to call all the releaseGLObjects methods before the context is destroyed. You shouldn't need to call it on the root node provided the root node is still attached to the viewer when the viewer and context

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-23 Thread Chris Djali
Hi, Now Robert seems to be back from his break, I'm just going to mention the potential footguns I found here in case they need sorting out. I've got a reasonable solution for the issue I was having, so that doesn't really need discussing any more, but it seems sensible to me that OSG might

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-23 Thread Chris Djali
Hi, Now Robert seems to be back from his break, I'm just going to mention the potential footguns I found here in case they need sorting out. I've got a reasonable solution for the issue I was having, so that doesn't really need discussing any more, but it seems sensible to me that OSG might

Re: [osg-users] Android: Survive Context Loss without complete reinitialization

2019-07-23 Thread Chris Djali
Hi, This is almost certainly due to one of the issues I've outlined here: http://forum.openscenegraph.org/viewtopic.php?p=76471#76471 The standard viewer definitely doesn't clean everything up that it's supposed to, as demonstrated by the examples I gave in that thread. Specifically, this

Re: [osg-users] An entity that could build OSG?

2019-07-24 Thread Chris Djali
Hi, Try using the GUI version of CMake - if you select the compiler you want to use as the generator, it'll try looking for that compiler instead of defaulting to NMake makefiles, which usually use Visual C++. Cheers, Chris -- Read this topic online here:

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-25 Thread Chris Djali
Hi, Annoyingly, while that branch fixes the issue in my examples, it isn't fixing it in my actual application. The cache gets cleared when the application exits (potentially after all OpenGL contexts have been closed), but not when views are added to and removed from the composite viewer, so

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-25 Thread Chris Djali
Hi, I have more information. The GraphicsContext is only referenced by the camera when the camera is destroyed. The camera detaches itself from the graphics context in its destructor, then the camera's ref_ptr to the graphics context is destroyed, triggering the destruction of the graphics

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-07-25 Thread Chris Djali
Hi, > Are the Camera's being removed from the Window before it gets closed? I have > just checked the GraphicsContext::close() method and it calls all the > Camera::releaseGLObjects(), which in turn will call the > Renderer::releaseGLObjects(), which will now call the >

[osg-users] DEEP_COPY_USERDATA isn't that deep

2019-09-20 Thread Chris Djali
Hi, Is it intentional that using osg::CopyOp::DEEP_COPY_USERDATA copies the UserDataContainer, but doesn't deep-copy the actual things in it unless osg::CopyOp::DEEP_COPY_OBJECTS is also enabled? This means that things can be added or removed, but changes to existing things are shared. We

Re: [osg-users] glClampColor with GL CORE profile

2019-09-19 Thread Chris Djali
Hi, Are you definitely creating an OpenGL context with either a version less than or equal to 3.0, or as a compatibility profile? This sounds to me like you've got a core profile, so don't have access to old deprecated stuff, but are trying to use it anyway. Cheers, Chris --

Re: [osg-users] glClampColor with GL CORE profile

2019-09-19 Thread Chris Djali
Hi, Somehow I missed the several parts about you intentionally using a core profile. I guess the most reasonable thing to do is submit an issue report that https://github.com/openscenegraph/OpenSceneGraph/blob/OpenSceneGraph-3.6/src/osg/ClampColor.cpp#L52-L53 should be fenced off so they don't

Re: [osg-users] DEEP_COPY_USERDATA isn't that deep

2019-09-28 Thread Chris Djali
Hi, Is there a way to copy something if all I have is a ref_ptr to Referenced? I see that Object has a clone method, but Referenced doesn't. This poses a potential problem with deep-copying user data, as osg::DefaultUserDataContainer::_userData is a ref_ptr. Cheers, Chris --

Re: [osg-users] DEEP_COPY_USERDATA isn't that deep

2019-09-28 Thread Chris Djali
Hi, I'm not seeing a particularly easy way to deep-copy the rest of the stuff in osg::DefaultUserDataContainer, either. The description list is a vector of strings, which are deep-copied, so that's fine, but the object list is harder as I'd need to cast the const off the CopyOp if I were to

Re: [osg-users] DEEP_COPY_USERDATA isn't that deep

2019-09-23 Thread Chris Djali
Hi, Good, but would the new enum entry be for the current behaviour or the new behaviour? If the current behaviour is a bug, then it makes sense to only keep the old behaviour as the new enum value so everyone gets the fix, but conceivably there could be applications that rely on the current

Re: [osg-users] DEEP_COPY_USERDATA isn't that deep

2019-09-22 Thread Chris Djali
Hi, How do you want backwards compatibility to be handled? The current behaviour could just be dropped, or it could be available under a new flag name like SHALLOW_COPY_USERDATA (potentially with the same value as the current deep copy one), or the new behaviour could be under a new flag name

Re: [osg-users] glClampColor with GL CORE profile

2019-09-23 Thread Chris Djali
Hi, Yeah, they're pretty obviously deprecated as they control fixed-function stuff, and the whole FFP was deprecated ages ago. Cheers, Chris -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=76737#76737

Re: [osg-users] Removing objects with shared GL state from scene graph

2019-06-30 Thread Chris Djali
Hi, I still think you're completely missing my point because of a criticism of my example code. For now, ignore the symptoms that brought me here. Just consider your bog-standard single-viewer situation. If a text node is added to the scene graph and stays attached for the whole lifetime of

Re: [osg-users] DEEP_COPY_USERDATA isn't that deep

2019-10-20 Thread Chris Djali
Hi, It's been pointed out to me that the DefaultUserDataContainer object list can be a little bit more deeply copied with this change: Code: --- a/src/osg/UserDataContainer.cpp +++ b/src/osg/UserDataContainer.cpp @@ -56,7 +56,10 @@ DefaultUserDataContainer::DefaultUserDataContainer(const

Re: [osg-users] Clipping osgText::Text

2019-10-25 Thread Chris Djali
Hi, It might not necessarily be fast, as you'd be changing state that would normally stay the same between consecutive draw calls, but you could also change the scissor rectangle to the region you want to keep, or you could draw a rectangle with the same depth as the text, then set the depth

Re: [osg-users] Image from shader

2019-10-07 Thread Chris Djali
Hi, The name texUnit0 comes from the shader, which you're providing. The texture unit index (which my example snippet sets to 0) comes from your scene graph, which you said came from osgOcean, and will almost certainly be 0 for a diffuse map. If I was trying to check that, I'd run the

Re: [osg-users] Image from shader

2019-10-03 Thread Chris Djali
Hi, I'm pretty sure you're not using your shaders at all. You're not setting gl_Position in the vertex shader, so it's not going to compile, and OSG will fall back to either its basic shader or fixed-function mode depending on how you've set it up. You should be seeing errors printed to the

Re: [osg-users] Image from shader

2019-10-04 Thread Chris Djali
Hi, OSGOcean is probably setting up the necessary fixed-function stuff to put its texture in texture unit zero, but you'll need to tell the fragment shader that its texUnit0 uniform refers to that texture unit. It should be enough just to add a uniform to the same stateset as you're adding

Re: [osg-users] Image from shader

2019-10-04 Thread Chris Djali
Hi, If you're not seeing any errors in the console, I don't think you've added your shader to the scene properly. You have to assign something to gl_Position otherwise the rasteriser has no idea where your vertex is, so doesn't know which pixels any triangles cover, and nothing will get drawn.

Re: [osg-users] Please test OpenScenGraph-3.6 branch in prep for the up commign 3.6.5 maintainance release

2019-12-17 Thread Chris Djali / AnyOldName3
Hi Robert, OpenMW still experiences some regressions when built with OSG 3.6.x instead of 3.4.1. It's completely possible they're because we're trying to coerce OSG systems to do things they weren't intended to as it's a big project created without much interaction with the OSG community. The

Re: [osg-users] Please test OpenScenGraph-3.6 branch in prep for the up commign 3.6.5 maintainance release

2019-12-18 Thread Chris Djali / AnyOldName3
On Wednesday, 18 December 2019 10:56:39 UTC, Robert Osfield wrote: > > > > On Tuesday, 17 December 2019 21:40:37 UTC, Chris Djali / AnyOldName3 wrote: >> >> Hi Robert, >> >> OpenMW still experiences some regressions when built with OSG 3.6.x >> inst

Re: [osg-users] How to access material properties from a GLSL shader?

2020-01-08 Thread Chris Djali / AnyOldName3
Hi, osg::Material pretty much encapsulates OpenGL's fixed-function material state, so things like glMaterialfv (that controls material settings for whole draw calls) and glColorMaterial (that controls what vertex colours actually affect). If you're using a suitably old GLSL version, you can

Re: [osg-users] Explicitly requesting default state for attribute

2020-12-18 Thread Chris Djali / AnyOldName3
simple solution shows up for anyone searching for this in the future. Cheers, Chris On Friday, 11 December 2020 at 19:38:26 UTC Chris Djali / AnyOldName3 wrote: > Hi, > > I'm working on a node visitor that converts FFP state to shaders and am > extending it so it can handle more