mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-12 09:06:55 -04:00
Add method to check if texture IDs and vertex buffer IDs are valid.
This commit is contained in:
parent
1b2013f689
commit
345df89a45
@ -40,6 +40,8 @@ namespace ClassicalSharp.GraphicsAPI {
|
||||
DeleteTexture( ref texture.ID );
|
||||
}
|
||||
|
||||
public abstract bool IsValidTexture( int texId );
|
||||
|
||||
|
||||
/// <summary> Whether fog is currently enabled. </summary>
|
||||
public abstract bool Fog { set; }
|
||||
@ -123,6 +125,8 @@ namespace ClassicalSharp.GraphicsAPI {
|
||||
public abstract IndexedVbInfo InitIndexedVb<T>( T[] vertices, ushort[] indices, DrawMode mode,
|
||||
int verticesCount, int indicesCount ) where T : struct;
|
||||
|
||||
public abstract bool IsValidVb( int vb );
|
||||
|
||||
public abstract void DeleteVb( int id );
|
||||
|
||||
public abstract void DeleteIndexedVb( IndexedVbInfo id );
|
||||
|
@ -165,6 +165,10 @@ namespace ClassicalSharp.GraphicsAPI {
|
||||
texId = -1;
|
||||
}
|
||||
|
||||
public override bool IsValidTexture( int texId ) {
|
||||
return GL.IsTexture( texId );
|
||||
}
|
||||
|
||||
public override bool Texturing {
|
||||
set { ToggleCap( EnableCap.Texture2D, value ); }
|
||||
}
|
||||
@ -371,6 +375,10 @@ namespace ClassicalSharp.GraphicsAPI {
|
||||
GL.Arb.DeleteBuffers( 2, ref id.Vb );
|
||||
}
|
||||
|
||||
public override bool IsValidVb( int vb ) {
|
||||
return useVbos ? GL.Arb.IsBuffer( vb ) : GL.IsList( vb );
|
||||
}
|
||||
|
||||
public override void DrawVbPos3fTex2f( DrawMode mode, int id, int verticesCount ) {
|
||||
BeginVbBatch( VertexFormat.VertexPos3fTex2f );
|
||||
DrawVbBatch( mode, id, verticesCount );
|
||||
|
Loading…
x
Reference in New Issue
Block a user