Page 1 of 1

problem with glMapBufferRange on OSX

Posted: Wed Mar 27, 2019 3:00 pm
by bayoubengal
hi.

I'm continuing my adventures with Ogre 2.1 in an OSX desktop app. I have the metal side working with multiple windows. However, the Opengl side fails. The function:

GL3PlusDynamicBuffer::map( size_t start, size_t count,
size_t &outTicket )

fails because glMapBufferRange( GL_COPY_WRITE_BUFFER, 33554432, 50) fails when render cycle starts to operate on the 2nd graphics context. the gl error code is GL_INVALID_OPERATION. I've checked that none of the conditions for that error listed in the documentation are true. From what I can tell, it appears that the memory mapping works fine and correctly until it starts to operate on the 2nd context. I'm at a dead end. Every theory I have concocted to explain why it is failing has failed. Its not a threading issue. the problem occurs even if all opengl activity is confined to the main thread. The current NS and CGL contexts are set correctly at each stage. I see no abuse of the ABI.

Any ideas on what could be going wrong?

Re: problem with glMapBufferRange on OSX

Posted: Wed Mar 27, 2019 4:42 pm
by dark_sylinc
Are you using 2 contexts or the same context associated with multiple windows?

Because the former is not supported: although the contexts could be set to share resources (which at driver level is already a buggy mess that never works as documented), Vaos and FBOs are not shared between the contexts, causing lots of invalid operation errors.

Re: problem with glMapBufferRange on OSX

Posted: Wed Mar 27, 2019 5:44 pm
by bayoubengal
2 independent contexts along with 2 scene managers and 2 workspaces. the two are entirely independent. configured identically, but independent.

Re: problem with glMapBufferRange on OSX

Posted: Wed Mar 27, 2019 6:14 pm
by bayoubengal
Based on your statement, I got it working by creating independent materials for each window. thanks.