OpenGL demo thread safety



I'm in the process of making a reasonable sized 3D engine around the OpenGL classes (to go on top of quite a large Juce project already).  I'm just trying to sort out using the UI to change the OpenGL scene.

It doesn't seem the Juce demo for OpenGL takes any specific precautions transferring from the UI to GL threads.  In particular the draggableOrientation component would seem to my (possibly wrong!) judgement to be suseptible to false values.  Only half the quaternion set  when the graphics thread is reading it.  (granted that would be corrected a frame later)  Is this the case or have I missed something that makes this safe?



Yes, to be honest the demo is a bit fast-and-loose about thread-safety, to keep the code simple. If you're passing more complex real-world data around then you'll probably want to take more care over it.

Cool, I figured that was the case, I just wanted to make sure I hadn't missed something.  Thanks for clarifying.


Nice work on all the extra GL code (shaders, textures etc.), it's made things way easier than I though it would be.  Part of what I'm trying to work out a nice way to translate a mouse event into interacting with something in 3D space (grabbing an object and moving it) and then using that info to change something on the UI side.  Get's a little tricky with non-primitive values.  In game engines usually the UI just runs on the same thread as graphics.

(I'm already using LockFreeFIFO's in places, it's more of an architectural problem for the whole application I need to solve)

I'm in the process of making a reasonable sized 3D engine around the OpenGL classes

Do you plan to share the results with the rest of the world?

That could definitely be a possibilty.  It's still slightly early days but I'm working full time on it at the moment so development is pretty quick.  I've spent years working in the games industry so I'm not new to 3D engines. ;)  I'm basically mirroring the Unity API, they do a lot of things right but unfortunately the overhead of Unity doesn't leave enough room for all the audio stuff I have going on.  I need something a little leaner.

I'll post up some progress when there's a little more to show.

That's fantastic. :)

I know there already were some attempts to combine JUCE with an external 3d engine like Ogre, but mostly without much success.

A perfectly integrated 3d engine with a sophisticated API would definitely find its users. ;)