Closed dustinanon closed 13 years ago
Locally, I fixed the problem by replacing the if (inUpdate) check in perform() with if (Thread.currentThread() == CCDirector.sharedDirector().getOpenGLView().getGLThread()). (I had to add an accessor to GLSurfaceView to return the GL thread.
This means if we're running in the GL thread, we'll go ahead and perform the resource load. Otherwise, it will be added to the task queue, to be performed at the next update.
This seems like a less hacky way, in my opinion. But maybe opengenius should decide, as I believe he's the one who built the whole resource loading queue.
Thanks very much:-)
I agree that the issue should be decided upon by the architect, but at least the issue is known, and a workaround is provided :)
Added some synchronization to force gl updates to actually run on the GL thread...
It turns out that GLResourceHelper.update() doesn't necessarily always run on the GLThread... this code forces the update method to actually run on the GLThread, but is a little hackish.
This might point you guys in the right direction to a fix, but for now it works without any noticeable performance impact.