Exemplo n.º 1
0
 private void PlatformSetDataInternal <T>(int offsetInBytes, T[] data, int startIndex, int elementCount, SetDataOptions options) where T : struct
 {
     if (Threading.IsOnUIThread())
     {
         BufferData(offsetInBytes, data, startIndex, elementCount, options);
     }
     else
     {
         Threading.BlockOnUIThread(() => BufferData(offsetInBytes, data, startIndex, elementCount, options));
     }
 }
Exemplo n.º 2
0
 private void PlatformSetDataInternal <T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride, SetDataOptions options, int bufferSize, int elementSizeInBytes) where T : struct
 {
     if (Threading.IsOnUIThread())
     {
         SetBufferData(bufferSize, elementSizeInBytes, offsetInBytes, data, startIndex, elementCount, vertexStride, options);
     }
     else
     {
         Threading.BlockOnUIThread(() => SetBufferData(bufferSize, elementSizeInBytes, offsetInBytes, data, startIndex, elementCount, vertexStride, options));
     }
 }
 /// <summary>
 /// Adds a dispose action to the list of pending dispose actions. These are executed at the end of each call to Present().
 /// This allows GL resources to be disposed from other threads, such as the finalizer.
 /// </summary>
 /// <param name="disposeAction">The action to execute for the dispose.</param>
 static private void AddDisposeAction(Action disposeAction)
 {
     if (disposeAction == null)
     {
         throw new ArgumentNullException("disposeAction");
     }
     if (Threading.IsOnUIThread())
     {
         disposeAction();
     }
     else
     {
         lock ( disposeActionsLock )
         {
             disposeActions.Add(disposeAction);
         }
     }
 }
Exemplo n.º 4
0
        private void PlatformGetData <T>(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct
        {
#if GLES
            // Buffers are write-only on OpenGL ES 1.1 and 2.0.  See the GL_OES_mapbuffer extension for more information.
            // http://www.khronos.org/registry/gles/extensions/OES/OES_mapbuffer.txt
            throw new NotSupportedException("Index buffers are write-only on OpenGL ES platforms");
#endif
#if !GLES
            if (Threading.IsOnUIThread())
            {
                GetBufferData(offsetInBytes, data, startIndex, elementCount);
            }
            else
            {
                Threading.BlockOnUIThread(() => GetBufferData(offsetInBytes, data, startIndex, elementCount));
            }
#endif
        }