diff --git a/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs b/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs index 59b843746..369242c3e 100644 --- a/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs +++ b/ClassicalSharp/GraphicsAPI/Direct3D9Api.cs @@ -180,10 +180,6 @@ namespace ClassicalSharp.GraphicsAPI { Delete( textures, texId ); texId = -1; } - - public override bool IsValidTexture( int texId ) { - return texId < textures.Length && textures[texId] != null; - } int lastClearCol; public override void Clear() { @@ -233,13 +229,21 @@ namespace ClassicalSharp.GraphicsAPI { D3D.VertexFormat.Position | D3D.VertexFormat.Texture2 | D3D.VertexFormat.Diffuse, }; - public override int InitVb( T[] vertices, VertexFormat format, int count ) { + public override int CreateVb( T[] vertices, VertexFormat format, int count ) { VertexBuffer buffer = CreateVb( vertices, count, format ); return GetOrExpand( ref vBuffers, buffer, vBufferSize ); } - public override int InitIb( ushort[] indices, int count ) { - IndexBuffer buffer = CreateIb( indices, count ); + public unsafe override int CreateIb( ushort[] indices, int count ) { + IndexBuffer buffer; + fixed( ushort* src = indices ) + buffer = CreateIndexBuffer( (IntPtr)src, count ); + + return GetOrExpand( ref iBuffers, buffer, iBufferSize ); + } + + public override int CreateIb( IntPtr indices, int count ) { + IndexBuffer buffer = CreateIndexBuffer( indices, count ); return GetOrExpand( ref iBuffers, buffer, iBufferSize ); } @@ -257,14 +261,12 @@ namespace ClassicalSharp.GraphicsAPI { return buffer; } - unsafe IndexBuffer CreateIb( ushort[] indices, int count ) { - int sizeInBytes = count * 2; + unsafe IndexBuffer CreateIndexBuffer( IntPtr src, int count ) { + int sizeInBytes = count * sizeof( ushort ); IndexBuffer buffer = new IndexBuffer( device, sizeInBytes, Usage.None, Pool.Managed, true ); IntPtr vbData = buffer.Lock( 0, sizeInBytes, LockFlags.None ); - fixed( ushort* src = indices ) { - memcpy( (IntPtr)src, vbData, sizeInBytes ); - } + memcpy( src, vbData, sizeInBytes ); buffer.Unlock(); return buffer; } @@ -276,14 +278,6 @@ namespace ClassicalSharp.GraphicsAPI { public override void DeleteIb( int ib ) { Delete( iBuffers, ib ); } - - public override bool IsValidVb( int vb ) { - return IsValid( vBuffers, vb ); - } - - public override bool IsValidIb( int ib ) { - return IsValid( iBuffers, ib ); - } public override void DrawVb( DrawMode mode, VertexFormat format, int id, int startVertex, int verticesCount ) { device.SetStreamSource( 0, vBuffers[id], 0, strideSizes[(int)format] ); @@ -320,10 +314,6 @@ namespace ClassicalSharp.GraphicsAPI { indicesCount / 6 * 4, startIndex, NumPrimitives( indicesCount, mode ) ); } - public override void EndIndexedVbBatch() { - device.SetIndices( null ); - } - #endregion @@ -550,10 +540,6 @@ namespace ClassicalSharp.GraphicsAPI { return vertices / 2; } - static bool IsValid( T[] array, int id ) { - return id > 0 && id < array.Length && array[id] != null; - } - protected unsafe override void LoadOrthoMatrix( float width, float height ) { Matrix4 matrix = Matrix4.CreateOrthographicOffCenter( 0, width, height, 0, 0, 1 ); matrix.M33 = -1; diff --git a/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs b/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs index 6aa18068e..751c89f1d 100644 --- a/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs +++ b/ClassicalSharp/GraphicsAPI/IGraphicsApi.cs @@ -51,8 +51,6 @@ namespace ClassicalSharp.GraphicsAPI { DeleteTexture( ref texture.ID ); } - public abstract bool IsValidTexture( int texId ); - /// Whether fog is currently enabled. public abstract bool Fog { set; } @@ -100,21 +98,19 @@ namespace ClassicalSharp.GraphicsAPI { public abstract int CreateDynamicVb( VertexFormat format, int maxVertices ); - public abstract void DrawDynamicVb( DrawMode mode, int vb, T[] vertices, VertexFormat format, int count ) where T : struct; - - public virtual int InitVb( T[] vertices, VertexFormat format ) where T : struct { - return InitVb( vertices, format, vertices.Length ); + public virtual int CreateVb( T[] vertices, VertexFormat format ) where T : struct { + return CreateVb( vertices, format, vertices.Length ); } - public abstract int InitVb( T[] vertices, VertexFormat format, int count ) where T : struct; + public abstract int CreateVb( T[] vertices, VertexFormat format, int count ) where T : struct; - public abstract int InitIb( ushort[] indices, int indicesCount ); + public abstract int CreateIb( ushort[] indices, int indicesCount ); - public abstract int InitIb( IntPtr indices, int indicesCount ); + public abstract int CreateIb( IntPtr indices, int indicesCount ); - public abstract bool IsValidVb( int vb ); + public abstract void BindVb( int vb ); - public abstract bool IsValidIb( int ib ); + public abstract void BindIb( int ib ); public abstract void DeleteDynamicVb( int id ); @@ -122,6 +118,8 @@ namespace ClassicalSharp.GraphicsAPI { public abstract void DeleteIb( int ib ); + public abstract void DrawDynamicVb( DrawMode mode, int vb, T[] vertices, VertexFormat format, int count ) where T : struct; + public abstract void DrawVb( DrawMode mode, VertexFormat format, int id, int startVertex, int verticesCount ); public abstract void BeginVbBatch( VertexFormat format ); @@ -130,14 +128,8 @@ namespace ClassicalSharp.GraphicsAPI { public abstract void BeginIndexedVbBatch(); - public abstract void BindVb( int vb ); - - public abstract void BindIb( int ib ); - public abstract void DrawIndexedVb( DrawMode mode, int indicesCount, int startVertex, int startIndex ); - public abstract void EndIndexedVbBatch(); - protected static int[] strideSizes = { 20, 16, 24 }; public abstract void SetMatrixMode( MatrixType mode ); diff --git a/ClassicalSharp/GraphicsAPI/OpenGLApi.cs b/ClassicalSharp/GraphicsAPI/OpenGLApi.cs index d0c5838ad..6bab2b6d1 100644 --- a/ClassicalSharp/GraphicsAPI/OpenGLApi.cs +++ b/ClassicalSharp/GraphicsAPI/OpenGLApi.cs @@ -139,10 +139,6 @@ namespace ClassicalSharp.GraphicsAPI { texId = -1; } - public override bool IsValidTexture( int texId ) { - return GL.IsTexture( texId ); - } - public override bool Texturing { set { ToggleCap( EnableCap.Texture2D, value ); } } @@ -193,21 +189,21 @@ namespace ClassicalSharp.GraphicsAPI { return id; } - public unsafe override int InitVb( T[] vertices, VertexFormat format, int count ) { + public unsafe override int CreateVb( T[] vertices, VertexFormat format, int count ) { int id = GenAndBind( BufferTarget.ArrayBuffer ); int sizeInBytes = count * strideSizes[(int)format]; GL.BufferDataARB( BufferTarget.ArrayBuffer, new IntPtr( sizeInBytes ), vertices, BufferUsageHint.StaticDraw ); return id; } - public unsafe override int InitIb( ushort[] indices, int indicesCount ) { + public unsafe override int CreateIb( ushort[] indices, int indicesCount ) { int id = GenAndBind( BufferTarget.ElementArrayBuffer ); int sizeInBytes = indicesCount * sizeof( ushort ); GL.BufferDataARB( BufferTarget.ElementArrayBuffer, new IntPtr( sizeInBytes ), indices, BufferUsageHint.StaticDraw ); return id; } - public unsafe override int InitIb( IntPtr indices, int indicesCount ) { + public unsafe override int CreateIb( IntPtr indices, int indicesCount ) { int id = GenAndBind( BufferTarget.ElementArrayBuffer ); int sizeInBytes = indicesCount * sizeof( ushort ); GL.BufferDataARB( BufferTarget.ElementArrayBuffer, new IntPtr( sizeInBytes ), indices, BufferUsageHint.StaticDraw ); @@ -246,14 +242,6 @@ namespace ClassicalSharp.GraphicsAPI { GL.DeleteBuffersARB( 1, &id ); } - public override bool IsValidVb( int vb ) { - return GL.IsBufferARB( vb ); - } - - public override bool IsValidIb( int ib ) { - return GL.IsBufferARB( ib ); - } - public override void DrawVb( DrawMode mode, VertexFormat format, int id, int startVertex, int verticesCount ) { BeginVbBatch( format ); GL.BindBufferARB( BufferTarget.ArrayBuffer, id ); @@ -315,10 +303,6 @@ namespace ClassicalSharp.GraphicsAPI { GL.DrawElements( modeMappings[(int)mode], indicesCount, indexType, new IntPtr( startIndex * 2 ) ); } - public override void EndIndexedVbBatch() { - GL.BindBufferARB( BufferTarget.ElementArrayBuffer, 0 ); - } - IntPtr zero = new IntPtr( 0 ), twelve = new IntPtr( 12 ), sixteen = new IntPtr( 16 ); void SetupVbPos3fTex2f() { GL.VertexPointer( 3, PointerType.Float, VertexPos3fTex2f.Size, zero ); diff --git a/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs b/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs index 044b08192..a374d5ae4 100644 --- a/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs +++ b/ClassicalSharp/Map/ChunkMeshBuilderTex2Col4.cs @@ -129,7 +129,7 @@ namespace ClassicalSharp { if( part.iCount == 0 ) return; ChunkPartInfo info; - info.VbId = Graphics.InitVb( part.vertices, VertexFormat.Pos3fTex2fCol4b, part.vCount ); + info.VbId = Graphics.CreateVb( part.vertices, VertexFormat.Pos3fTex2fCol4b, part.vCount ); info.IndicesCount = part.iCount; info.leftCount = (ushort)part.Count.left; info.rightCount = (ushort)part.Count.right; info.frontCount = (ushort)part.Count.front; info.backCount = (ushort)part.Count.back; diff --git a/ClassicalSharp/Model/ChickenModel.cs b/ClassicalSharp/Model/ChickenModel.cs index 2134a122c..ad59beea2 100644 --- a/ClassicalSharp/Model/ChickenModel.cs +++ b/ClassicalSharp/Model/ChickenModel.cs @@ -18,7 +18,7 @@ namespace ClassicalSharp.Model { LeftWing = MakeWing( -0.25f, -0.1875f ); RightWing = MakeWing( 0.1875f, 0.25f ); - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; DefaultTexId = graphics.LoadTexture( "chicken.png" ); } diff --git a/ClassicalSharp/Model/CreeperModel.cs b/ClassicalSharp/Model/CreeperModel.cs index 89ffefc04..777520f3d 100644 --- a/ClassicalSharp/Model/CreeperModel.cs +++ b/ClassicalSharp/Model/CreeperModel.cs @@ -16,7 +16,7 @@ namespace ClassicalSharp.Model { LeftLegBack = MakeLeg( -0.25f, 0, 0.125f, 0.375f ); RightLegBack = MakeLeg( 0, 0.25f, 0.125f, 0.375f ); - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; DefaultTexId = graphics.LoadTexture( "creeper.png" ); } diff --git a/ClassicalSharp/Model/PigModel.cs b/ClassicalSharp/Model/PigModel.cs index 4d314ad7b..5cffb6d67 100644 --- a/ClassicalSharp/Model/PigModel.cs +++ b/ClassicalSharp/Model/PigModel.cs @@ -16,7 +16,7 @@ namespace ClassicalSharp.Model { LeftLegBack = MakeLeg( -0.3125f, -0.0625f, 0.3125f, 0.5625f ); RightLegBack = MakeLeg( 0.0625f, 0.3125f, 0.3125f, 0.5625f ); - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; DefaultTexId = graphics.LoadTexture( "pig.png" ); } diff --git a/ClassicalSharp/Model/PlayerModel.cs b/ClassicalSharp/Model/PlayerModel.cs index 097cb4126..82a25e34a 100644 --- a/ClassicalSharp/Model/PlayerModel.cs +++ b/ClassicalSharp/Model/PlayerModel.cs @@ -38,7 +38,7 @@ namespace ClassicalSharp.Model { Set64x64Slim.RightArm = MakeRightArm( 40, 16, 0.25f, 0.4375f, 3, true ); Set64x64Slim.Hat = Set64x64.Hat; - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; using( Bitmap bmp = new Bitmap( "char.png" ) ) { diff --git a/ClassicalSharp/Model/SheepModel.cs b/ClassicalSharp/Model/SheepModel.cs index 4544a9283..96f1e2726 100644 --- a/ClassicalSharp/Model/SheepModel.cs +++ b/ClassicalSharp/Model/SheepModel.cs @@ -27,7 +27,7 @@ namespace ClassicalSharp.Model { FurRightLegBack = MakeFurLeg( 0.03125f, 0.34375f, 0.28125f, 0.59375f ); } - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; DefaultTexId = graphics.LoadTexture( "sheep.png" ); furTextureId = graphics.LoadTexture( "sheep_fur.png" ); diff --git a/ClassicalSharp/Model/SkeletonModel.cs b/ClassicalSharp/Model/SkeletonModel.cs index 5c9a44053..a45407e61 100644 --- a/ClassicalSharp/Model/SkeletonModel.cs +++ b/ClassicalSharp/Model/SkeletonModel.cs @@ -16,7 +16,7 @@ namespace ClassicalSharp.Model { LeftArm = MakeLeftArm( 0.375f, 0.25f ); RightArm = MakeRightArm( 0.25f, 0.375f ); - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; DefaultTexId = graphics.LoadTexture( "skeleton.png" ); } diff --git a/ClassicalSharp/Model/SpiderModel.cs b/ClassicalSharp/Model/SpiderModel.cs index db11c1714..446d94336 100644 --- a/ClassicalSharp/Model/SpiderModel.cs +++ b/ClassicalSharp/Model/SpiderModel.cs @@ -15,7 +15,7 @@ namespace ClassicalSharp.Model { LeftLeg = MakeLeg( -1.1875f, -0.1875f ); RightLeg = MakeLeg( 0.1875f, 1.1875f ); - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; DefaultTexId = graphics.LoadTexture( "spider.png" ); } diff --git a/ClassicalSharp/Model/ZombieModel.cs b/ClassicalSharp/Model/ZombieModel.cs index 774307570..e1753871d 100644 --- a/ClassicalSharp/Model/ZombieModel.cs +++ b/ClassicalSharp/Model/ZombieModel.cs @@ -16,7 +16,7 @@ namespace ClassicalSharp.Model { LeftArm = MakeLeftArm( 0.5f, 0.25f ); RightArm = MakeRightArm( 0.25f, 0.5f ); - vb = graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + vb = graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); vertices = null; DefaultTexId = graphics.LoadTexture( "zombie.png" ); } diff --git a/ClassicalSharp/Rendering/MapEnvRenderer.cs b/ClassicalSharp/Rendering/MapEnvRenderer.cs index 2a7bf64d4..f3d0ac9aa 100644 --- a/ClassicalSharp/Rendering/MapEnvRenderer.cs +++ b/ClassicalSharp/Rendering/MapEnvRenderer.cs @@ -161,7 +161,7 @@ namespace ClassicalSharp { DrawZPlane( Map.Length, 0, Map.Width, 0, groundLevel, sidesCol, vertices ); DrawXPlane( 0, 0, Map.Length, 0, groundLevel, sidesCol, vertices ); DrawXPlane( Map.Width, 0, Map.Length, 0, groundLevel, sidesCol, vertices ); - sidesVboId = Graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + sidesVboId = Graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); } void RebuildEdgesModern( int waterLevel ) { @@ -171,7 +171,7 @@ namespace ClassicalSharp { foreach( Rectangle rec in OutsideMap( Window.ViewDistance ) ) { DrawYPlane( rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height, waterLevel, edgesCol, vertices ); } - edgesVboId = Graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + edgesVboId = Graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); } #endregion @@ -196,7 +196,7 @@ namespace ClassicalSharp { DrawZPlaneParts( Map.Length, 0, Map.Width, 0, groundLevel, sidesCol, vertices ); DrawXPlaneParts( 0, 0, Map.Length, 0, groundLevel, sidesCol, vertices ); DrawXPlaneParts( Map.Width, 0, Map.Length, 0, groundLevel, sidesCol, vertices ); - sidesVboId = Graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + sidesVboId = Graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); } void RebuildEdgesLegacy( int waterLevel ) { @@ -209,7 +209,7 @@ namespace ClassicalSharp { foreach( Rectangle rec in OutsideMap( Window.ViewDistance ) ) { DrawYPlaneParts( rec.X, rec.Y, rec.X + rec.Width, rec.Y + rec.Height, waterLevel, edgesCol, vertices ); } - edgesVboId = Graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + edgesVboId = Graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); } const int axisSize = 128; diff --git a/ClassicalSharp/Rendering/MapRenderer.cs b/ClassicalSharp/Rendering/MapRenderer.cs index c214346b5..64b362997 100644 --- a/ClassicalSharp/Rendering/MapRenderer.cs +++ b/ClassicalSharp/Rendering/MapRenderer.cs @@ -273,24 +273,25 @@ namespace ClassicalSharp { } api.AlphaTest = false; api.Texturing = false; - api.EndIndexedVbBatch(); } int chunkIb = -1; - void MakeIndices() { + unsafe void MakeIndices() { int element = 0; - ushort[] indices = new ushort[maxIndices]; - for( int i = 0; i < indices.Length; ) { - indices[i++] = (ushort)( element + 0 ); - indices[i++] = (ushort)( element + 1 ); - indices[i++] = (ushort)( element + 2 ); + ushort* indices = stackalloc ushort[maxIndices]; + IntPtr ptr = (IntPtr)indices; + + for( int i = 0; i < maxIndices; i += 6 ) { + *indices++ = (ushort)( element + 0 ); + *indices++ = (ushort)( element + 1 ); + *indices++ = (ushort)( element + 2 ); - indices[i++] = (ushort)( element + 2 ); - indices[i++] = (ushort)( element + 3 ); - indices[i++] = (ushort)( element + 0 ); + *indices++ = (ushort)( element + 2 ); + *indices++ = (ushort)( element + 3 ); + *indices++ = (ushort)( element + 0 ); element += 4; } - chunkIb = api.InitIb( indices, indices.Length ); + chunkIb = api.CreateIb( ptr, maxIndices ); } // Render translucent(liquid) blocks. These 'blend' into other blocks. @@ -319,7 +320,6 @@ namespace ClassicalSharp { api.AlphaTest = false; api.AlphaBlending = false; api.Texturing = false; - api.EndIndexedVbBatch(); } } } \ No newline at end of file diff --git a/ClassicalSharp/Rendering/StandardEnvRenderer.cs b/ClassicalSharp/Rendering/StandardEnvRenderer.cs index 159a39a55..f27eca468 100644 --- a/ClassicalSharp/Rendering/StandardEnvRenderer.cs +++ b/ClassicalSharp/Rendering/StandardEnvRenderer.cs @@ -175,14 +175,14 @@ namespace ClassicalSharp.Renderers { cloudsVertices = 6; VertexPos3fTex2fCol4b[] vertices = new VertexPos3fTex2fCol4b[cloudsVertices]; DrawCloudsYPlane( x1, z1, x2, z2, y, Map.CloudsCol, vertices ); - cloudsVbo = Graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + cloudsVbo = Graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); } void ResetSkyModern( int y, int x1, int z1, int x2, int z2 ) { skyVertices = 6; VertexPos3fCol4b[] vertices = new VertexPos3fCol4b[skyVertices]; DrawSkyYPlane( x1, z1, x2, z2, y, Map.SkyCol, vertices ); - skyVbo = Graphics.InitVb( vertices, VertexFormat.Pos3fCol4b ); + skyVbo = Graphics.CreateVb( vertices, VertexFormat.Pos3fCol4b ); } #endregion @@ -193,14 +193,14 @@ namespace ClassicalSharp.Renderers { cloudsVertices = Utils.CountVertices( x2 - x1, z2 - z1, 128 ); VertexPos3fTex2fCol4b[] vertices = new VertexPos3fTex2fCol4b[cloudsVertices]; DrawCloudsYPlaneParts( x1, z1, x2, z2, y, Map.CloudsCol, vertices ); - cloudsVbo = Graphics.InitVb( vertices, VertexFormat.Pos3fTex2fCol4b ); + cloudsVbo = Graphics.CreateVb( vertices, VertexFormat.Pos3fTex2fCol4b ); } void ResetSkyLegacy( int y, int x1, int z1, int x2, int z2 ) { skyVertices = Utils.CountVertices( x2 - x1, z2 - z1, 128 ); VertexPos3fCol4b[] vertices = new VertexPos3fCol4b[skyVertices]; DrawSkyYPlaneParts( x1, z1, x2, z2, y, Map.SkyCol, vertices ); - skyVbo = Graphics.InitVb( vertices, VertexFormat.Pos3fCol4b ); + skyVbo = Graphics.CreateVb( vertices, VertexFormat.Pos3fCol4b ); } void DrawSkyYPlaneParts( int x1, int z1, int x2, int z2, int y, FastColour col, VertexPos3fCol4b[] vertices ) { diff --git a/ClassicalSharp/Selections/SelectionBox.cs b/ClassicalSharp/Selections/SelectionBox.cs index d55c4ffd7..4ce2d0361 100644 --- a/ClassicalSharp/Selections/SelectionBox.cs +++ b/ClassicalSharp/Selections/SelectionBox.cs @@ -51,7 +51,7 @@ namespace ClassicalSharp.Selections { Line( ref index, p2.X, p1.Y, p1.Z, p2.X, p2.Y, p1.Z, lineCol ); Line( ref index, p2.X, p1.Y, p2.Z, p2.X, p2.Y, p2.Z, lineCol ); Line( ref index, p1.X, p1.Y, p2.Z, p1.X, p2.Y, p2.Z, lineCol ); - LineVb = Graphics.InitVb( vertices, VertexFormat.Pos3fCol4b, LineVerticesCount ); + LineVb = Graphics.CreateVb( vertices, VertexFormat.Pos3fCol4b, LineVerticesCount ); index = 0; RenderYPlane( ref index, p1.X, p1.Z, p2.X, p2.Z, p1.Y, col ); // bottom @@ -60,7 +60,7 @@ namespace ClassicalSharp.Selections { RenderXPlane( ref index, p1.X, p2.X, p1.Y, p2.Y, p2.Z, col ); RenderZPlane( ref index, p1.Z, p2.Z, p1.Y, p2.Y, p1.X, col ); RenderZPlane( ref index, p1.Z, p2.Z, p1.Y, p2.Y, p2.X, col ); - Vb = Graphics.InitVb( vertices, VertexFormat.Pos3fCol4b, VerticesCount ); + Vb = Graphics.CreateVb( vertices, VertexFormat.Pos3fCol4b, VerticesCount ); } void Line( ref int index, float x1, float y1, float z1, float x2, float y2, float z2, FastColour col ) { diff --git a/OpenTK/Graphics/OpenGL/GL.cs b/OpenTK/Graphics/OpenGL/GL.cs index fb4732151..0f185688c 100644 --- a/OpenTK/Graphics/OpenGL/GL.cs +++ b/OpenTK/Graphics/OpenGL/GL.cs @@ -164,18 +164,6 @@ namespace OpenTK.Graphics.OpenGL { Interop.Calli( (int)target, (int)mode, HintAddress ); } static IntPtr HintAddress; - public static bool IsBuffer( int buffer ) { - return Interop.Calli_UInt8( buffer, IsBufferAddress ) != 0; - } static IntPtr IsBufferAddress; - - public static bool IsBufferARB( int buffer ) { - return Interop.Calli_UInt8( buffer, IsBufferARBAddress ) != 0; - } static IntPtr IsBufferARBAddress; - - public static bool IsTexture( int texture ) { - return Interop.Calli_UInt8( texture, IsTextureAddress ) != 0; - } static IntPtr IsTextureAddress; - public static void LoadIdentity() { Interop.Calli( LoadIdentityAddress ); } static IntPtr LoadIdentityAddress; diff --git a/OpenTK/Graphics/OpenGL/GLHelper.cs b/OpenTK/Graphics/OpenGL/GLHelper.cs index 3baffc2f0..f58cb42fb 100644 --- a/OpenTK/Graphics/OpenGL/GLHelper.cs +++ b/OpenTK/Graphics/OpenGL/GLHelper.cs @@ -64,9 +64,6 @@ namespace OpenTK.Graphics.OpenGL GetIntegervAddress = GetAddress( "glGetIntegerv" ); GetStringAddress = GetAddress( "glGetString" ); HintAddress = GetAddress( "glHint" ); - IsBufferAddress = GetAddress( "glIsBuffer" ); - IsBufferARBAddress = GetAddress( "glIsBufferARB" ); - IsTextureAddress = GetAddress( "glIsTexture" ); LoadIdentityAddress = GetAddress( "glLoadIdentity" ); LoadMatrixfAddress = GetAddress( "glLoadMatrixf" ); MatrixModeAddress = GetAddress( "glMatrixMode" );