-
Notifications
You must be signed in to change notification settings - Fork 1
/
GraphicsResource.cs
43 lines (42 loc) · 1.36 KB
/
GraphicsResource.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using OpenTK.Graphics.OpenGL4;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace GLGraphics
{
public abstract class GraphicsResource : GLObject
{
public GraphicsResource(GLObjectType GLObjectType) : base(GLObjectType)
{
int handle = 0;
switch (GLObjectType)
{
case GLObjectType.VertexArray:
GL.CreateVertexArrays(1, out handle);
break;
case GLObjectType.Buffer:
GL.CreateBuffers(1, out handle);
break;
case GLObjectType.FrameBuffer:
GL.CreateFramebuffers(1, out handle);
break;
case GLObjectType.Program:
handle = GL.CreateProgram();
break;
case GLObjectType.Sampler:
GL.CreateSamplers(1, out handle);
break;
case GLObjectType.ProgramPipeline:
GL.CreateProgramPipelines(1, out handle);
break;
case GLObjectType.RenderBuffer:
GL.CreateRenderbuffers(1, out handle);
break;
default:
break;
}
Handle = handle;
}
}
}