smrendererv3/SMCode/SM.OGL/GLObject.cs
Michel Fedde c4a0847567 20.09.2020
+ Instance Drawing
+ Text and Font

~ Made "DrawBackground" forced Background for 2D

- DrawEmpty
2020-09-20 18:29:09 +02:00

35 lines
No EOL
749 B
C#

using OpenTK.Graphics.OpenGL4;
namespace SM.OGL
{
public abstract class GLObject
{
protected int _id = -1;
protected virtual bool AutoCompile { get; } = false;
public bool WasCompiled => _id > 0;
public virtual int ID
{
get
{
if (AutoCompile && _id < 0) Compile();
return _id;
}
}
public abstract ObjectLabelIdentifier TypeIdentifier { get; }
protected virtual void Compile()
{
}
public void Name(string name)
{
GL.ObjectLabel(TypeIdentifier, _id, name.Length, name);
}
public static implicit operator int(GLObject glo) => glo.ID;
}
}