Exemplo n.º 1
0
 //  Vertex Buffer
 public BufferRangeGL(BufferGL buffer)
 {
     this.buffer = buffer;
     unchecked
     {
         // Vertex buffers do not have a valid begin mode value
         this.beginMode = (BeginMode)(uint.MaxValue);
     }
 }
Exemplo n.º 2
0
        public BufferGL GetUniformBufferGL(BufferUsageHint usage)
        {
            if (Configuration.useGl1)
            {
                throw new InvalidOperationException("GL1 does not support uniform buffers");
            }
            //return new Buffer(BufferTarget.UniformBuffer, usage);
#if true
            lock (this)
            {
                if (uniformBuffersGL.ContainsKey(usage))
                {
                    //Debug.WriteLine("Returning old uniform buffer, usage = " + usage.ToString());
                    return(uniformBuffersGL[usage]);
                }
                //Debug.WriteLine("Creating new uniform buffer, usage = " + usage.ToString());
                var buffer = new BufferGL(BufferTarget.UniformBuffer, usage);
                uniformBuffersGL[usage] = buffer;
                return(buffer);
            }
#endif
        }
Exemplo n.º 3
0
        //  Uniform Buffer
        public BufferRangeGL(BufferGL buffer, IUniformBlock uniformBlock)
        {
#if DEBUG
            if (Configuration.useGl1)
            {
                throw new InvalidOperationException();
            }
#endif
            this.uniformBlock = uniformBlock as UniformBlockGL;
            if (this.uniformBlock == null)
            {
                throw new InvalidOperationException();
            }
            this.buffer = buffer;
            unchecked
            {
                this.beginMode = (BeginMode)(uint.MaxValue); // uniform buffers do not have a valid begin mode value
            }

            //  Pre-initialize uniform buffer as we do not use BeginEdit() / EndEdit()
            size = uniformBlock.Size;
            data = new byte[size];
        }
Exemplo n.º 4
0
        public void UseUniformBufferGL()
        {
#if DEBUG
            if (Configuration.useGl1)
            {
                throw new InvalidOperationException();
            }
#endif
#if DEBUG_UNIFORM_BUFFER
            System.Diagnostics.Debug.WriteLine(
                "GL.BindBufferRange(BufferTarget.UniformBuffer, " +
                uniformBlock.BindingPoint + ", " +
                (int)Buffer.BufferObject + ", " +
                (IntPtr)offsetBytes + ", " +
                (IntPtr)size +
                "); " + Name + " block " + uniformBlock.Name
                );
#endif
            BufferGL.BindRange(
                uniformBlock.BindingPointGL,
                (IntPtr)offsetBytes,
                (IntPtr)size
                );
        }
Exemplo n.º 5
0
 //  Index buffer, with valid begin mode
 internal BufferRangeGL(BufferGL buffer, BeginMode beginMode)
 {
     this.buffer    = buffer;
     this.beginMode = beginMode;
 }
Exemplo n.º 6
0
 public static void PerformDelayedUpdates()
 {
     BufferGL.PerformDelayedUpdates();
 }
Exemplo n.º 7
0
 internal BufferGLRL(DrawElementsType indexType, BufferUsageHint usageHint)
 {
     bufferGL = new BufferGL(indexType, usageHint);
     bufferRL = new BufferRL((Caustic.OpenRL.DrawElementsType)indexType, (Caustic.OpenRL.BufferUsageHint)usageHint);
 }
Exemplo n.º 8
0
 internal BufferGLRL(VertexFormat vertexFormat, BufferUsageHint usageHint)
 {
     bufferGL = new BufferGL(vertexFormat, usageHint);
     bufferRL = new BufferRL(vertexFormat, (Caustic.OpenRL.BufferUsageHint)usageHint);
 }
Exemplo n.º 9
0
 internal BufferGLRL(BufferTarget target, BufferUsageHint usageHint)
 {
     bufferGL = new BufferGL(target, usageHint);
     bufferRL = new BufferRL((Caustic.OpenRL.BufferTarget)target, (Caustic.OpenRL.BufferUsageHint)usageHint);
 }