Hello folks,

I have really weird dilemma: I have Win32 CAD program, whose OpenGL related DLL library is compiled by a Visual Studio 2010 and other parts of program are compiled dy Embarcadero XE8. The whole system works fine on three separate workstations when debugging it with Visual Studio 2010, but if I try to run the executable alone, some test files (not every file) doesn't show lightning, dark world or at least distorted static shadows shows up instead.

So, with debugger everything is working perfectly, but executable alone only part of the test files works as expected. And more confusion, if I first open a perfectly working file and then a file which doesn't show lightning, then both files are working perfectly or at least lights are on but shadows may be off. However, this misbehaviour is deterministic: it does always the same fails and same order even on different machines. Nvidia or AMD don't make a difference with regard to their behaviour or misbehaviour. GeForce GT 525M, AMD Radeon R6 and GeForce GTX 860M show equal behaviour.

What could be wrong?

1: I think this could be some out-of-memory problem. The program doesn't check available memory on board and it doesn't count the memory needed to load some file, but after loading more OpenGL stuff it checks GL_OUT_OF_MEMORY by glGetError(). But, because I get the lightning working by loading a file after another, this doesn't seem a memory problem (the first file is still loaded, so there is more OpenGL stuff on board). Anyway, opengl driver memory management is tricky -actually I dont know, I only guess- so if the driver feels it doesn't have enough memory or time, is it possible that driver just silently refuses to allocate space or transfer data and keep working like everything was okay?

2: On the other way, it is possible that CUDA or OpenCL could indirectly cause a lightning problem, but I don't delieve it because the behaviour is identical between a CUDA machine and an OpenCL machine. If the problem would be there, their behaviour would differ. Moreover, the case where lights are on but shadows are absent or distorted, is definitely not a CUDA or OpenCL case. But if you think I should double check or triple check CUDA/OpenCL, I'm glad if you tell it to me.

3: The third sympton would be threads: I use boost::thread and boost::asio libraries to handle four threads, and OpenGL rendering context is connected to two of them, in different times I hope. This is the thing I suspect at most. But, if this is the reason of misbehaviour, shouldn't it prevent rendering completely? All rendering is happening in a same thread, which calls a single render function that draws everything. Moreover, the program works either with OpenGL 4.0 or OpenGL 1.5, and they both use the same threading skeme. OpenGL 1.5 works perfectly with all files, so this is an indication that threads work correctly.

4: Some other reason you name it

Please help, any suggestions are welcome...