コード例 #1
0
ファイル: Sampler.cs プロジェクト: DarkKitsune/StarWander
 /// <summary>
 /// Construct a Sampler object
 /// </summary>
 /// <param name="name"></param>
 /// <param name="handle"></param>
 private Sampler(string name, int handle)
 {
     Name = name;
     GL.BindSampler(0, handle);
     GL.ObjectLabel(ObjectLabelIdentifier.Sampler, handle, name.Length, name);
     Handle = new GLHandle(handle);
 }
コード例 #2
0
 /// <summary>
 /// Construct a VertexAttributes object
 /// </summary>
 /// <param name="name"></param>
 /// <param name="handle"></param>
 private VertexAttributes(string name, int handle)
 {
     Name = name;
     VertexAttributeNames = new string[GL.GetInteger(GetPName.MaxVertexAttribs)];
     GL.BindVertexArray(handle);
     GL.ObjectLabel(ObjectLabelIdentifier.VertexArray, handle, name.Length, name);
     Handle = new GLHandle(handle);
 }
コード例 #3
0
 /// <summary>
 /// Construct a new ShaderProgram
 /// </summary>
 /// <param name="name"></param>
 /// <param name="handle"></param>
 private ShaderProgram(string name, int handle)
 {
     Name = name;
     if (State.VersionIsAtLeast(4, 3))
     {
         GL.ObjectLabel(ObjectLabelIdentifier.Program, handle, name.Length, name);
     }
     Handle = new GLHandle(handle);
 }
コード例 #4
0
 /// <summary>
 /// Construct a render buffer
 /// </summary>
 /// <param name="name"></param>
 /// <param name="handle"></param>
 private RenderBuffer(string name, int handle)
 {
     Name = name;
     GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, handle);
     if (State.VersionIsAtLeast(4, 3))
     {
         GL.ObjectLabel(ObjectLabelIdentifier.Renderbuffer, handle, name.Length, name);
     }
     Handle = new GLHandle(handle);
 }
コード例 #5
0
 /// <summary>
 /// Construct a shader
 /// </summary>
 /// <param name="name"></param>
 /// <param name="type"></param>
 /// <param name="handle"></param>
 private Shader(string name, ShaderType type, int handle)
 {
     Name       = name;
     ShaderType = type;
     if (State.VersionIsAtLeast(4, 3))
     {
         GL.ObjectLabel(ObjectLabelIdentifier.Shader, handle, name.Length, name);
     }
     Handle = new GLHandle(handle);
 }
コード例 #6
0
        /// <summary>
        /// Dispose this object
        /// </summary>
        public virtual void Dispose()
        {
            if (Disposed)
            {
                return;
            }

            Handle = GLHandle.Null;
            GL.DeleteBuffer(Handle.Handle);
            Disposed = true;
        }
コード例 #7
0
        /// <summary>
        /// Dispose this object
        /// </summary>
        public virtual void Dispose()
        {
            if (Disposed)
            {
                return;
            }

            Handle = GLHandle.Null;
            GL.DeleteVertexArray(Handle.Handle);
            Disposed = true;
        }
コード例 #8
0
 /// <summary>
 /// Construct a new buffer
 /// </summary>
 /// <param name="handle"></param>
 /// <param name="name"></param>
 /// <param name="size"></param>
 /// <param name="flags"></param>
 /// <param name="data"></param>
 private Buffer(
     int handle, string name, IntPtr size, BufferStorageFlags flags = BufferStorageFlags.None, IntPtr data = default
     )
 {
     GL.BindBuffer(BufferTarget.ArrayBuffer, handle);
     GL.BufferStorage(BufferTarget.ArrayBuffer, size, data, flags);
     if (State.VersionIsAtLeast(4, 3))
     {
         GL.ObjectLabel(ObjectLabelIdentifier.Buffer, handle, name.Length, name);
     }
     Handle = new GLHandle(handle);
     Name   = name;
 }
コード例 #9
0
 /// <summary>
 /// Construct a texture
 /// </summary>
 /// <param name="name"></param>
 /// <param name="handle"></param>
 /// <param name="levels"></param>
 private Texture2D(string name, int handle, int levels)
 {
     Name       = name;
     Levels     = levels;
     Dimensions = new Vector2 <int> [levels];
     Formats    = new PixelInternalFormat[levels];
     GL.BindTexture(TextureTarget.Texture2D, handle);
     if (State.VersionIsAtLeast(4, 3))
     {
         GL.ObjectLabel(ObjectLabelIdentifier.Texture, handle, name.Length, name);
     }
     GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMaxLevel, levels - 1);
     Handle = new GLHandle(handle);
 }