示例#1
0
 public override GlCallResult GlRender()
 {
     return(GlRenderHandler.GlCall(() =>
     {
         Mesh.GlRender();
     }, true));
 }
示例#2
0
文件: Mesh.cs 项目: Turpster/turpgine
        public override GlCallResult _glDispose()
        {
            return(GlRenderHandler.GlCall(() =>
            {
                GL.DeleteBuffers(1, ref GlElementBuffer);
                GL.DeleteBuffers(Enum.GetNames(typeof(VertexBuffer)).Length, GlBuffers);

                GL.DeleteVertexArray(GlVao);
            }));
        }
示例#3
0
文件: Mesh.cs 项目: Turpster/turpgine
 public GlCallResult GlRender()
 {
     return(GlRenderHandler.GlCall(() =>
     {
         GL.BindVertexArray(GlVao);
         GL.BindBuffer(BufferTarget.ElementArrayBuffer, GlElementBuffer);
         GL.DrawElements(PrimitiveType.Triangles, _numIndices, DrawElementsType.UnsignedInt, 0);
         GL.BindVertexArray(0);
     }, true));
 }
示例#4
0
        public override GlCallResult _glInitialise()
        {
            return(GlRenderHandler.GlCall(() =>
            {
                GlWrapModeX = TextureWrapMode.Repeat;
                GlWrapModeY = TextureWrapMode.Repeat;

                GlTextureMinFilter = new GlEventTextureFilter(TextureMagFilter.Linear);
                GlTextureMagFilter = new GlEventTextureFilter(TextureMagFilter.Linear);
            }));
        }
示例#5
0
文件: Mesh.cs 项目: Turpster/turpgine
        public override GlCallResult _glInitialise()
        {
            return(GlRenderHandler.GlCall(() =>
            {
                GL.GenVertexArrays(1, out GlVao);
                GL.BindVertexArray(GlVao);

                // Element Buffer
                GL.GenBuffers(1, out GlElementBuffer);
                GL.BindBuffer(BufferTarget.ElementArrayBuffer, GlElementBuffer);
                GL.BufferData(BufferTarget.ElementArrayBuffer, _indices.Length * Marshal.SizeOf(typeof(uint)),
                              _indices, BufferUsageHint.StaticDraw);
                _numIndices = _indices.Length;
                _indices = null;

                // Vertex Buffers
                var bufferLength = Enum.GetNames(typeof(VertexBuffer)).Length;
                GlBuffers = new uint[bufferLength];
                GL.GenBuffers(bufferLength, GlBuffers);

                GL.BindBuffer(BufferTarget.ArrayBuffer, GlBuffers[(int)VertexBuffer.Pos]);

                #if DEBUG
                var result = GlBufferData();
                if (!result.Synchronised)
                {
                    throw new InvalidAsynchronousStateException("GlBufferData() should be executing synchronised.");
                }
                #else
                GlBufferData();
                #endif

                GL.EnableVertexAttribArray((int)VertexBuffer.Pos);
                GL.VertexAttribPointer((int)VertexBuffer.Pos, _dimensions, VertexAttribPointerType.Float, false, 0, 0);

                GL.BindVertexArray(0);
            }));
        }
示例#6
0
 public override GlCallResult _glDispose()
 {
     return(GlRenderHandler.GlCall(() => { }));
 }
示例#7
0
 public override GlCallResult _glInitialise()
 {
     return(GlRenderHandler.GlCall(() => { }));
 }