MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / GL46Buffer

Method GL46Buffer

GTE/Graphics/GL46/GL46Buffer.cpp:17–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17GL46Buffer::GL46Buffer(Buffer const* buffer, GLenum type)
18 :
19 GL46Resource(buffer),
20 mType(type)
21{
22 glGenBuffers(1, &mGLHandle);
23
24 uint32_t usage = buffer->GetUsage();
25 if (usage == Resource::Usage::IMMUTABLE)
26 {
27 mUsage = GL_STATIC_DRAW;
28 }
29 else if (usage == Resource::Usage::DYNAMIC_UPDATE)
30 {
31 mUsage = GL_DYNAMIC_DRAW;
32 }
33 else // usage == Resource::Usage::SHADER_OUTPUT
34 {
35 // TODO: In GLSL, is it possible to write to a buffer other than a
36 // vertex buffer?
37 if (mType == GL_ARRAY_BUFFER)
38 {
39 mUsage = GL_STREAM_DRAW;
40 }
41 else if (mType == GL_SHADER_STORAGE_BUFFER)
42 {
43 mUsage = GL_DYNAMIC_DRAW;
44 }
45 else
46 {
47 // TODO: Can this buffer type be a shader output?
48 mUsage = GL_STATIC_DRAW;
49 }
50 }
51}
52
53void GL46Buffer::Initialize()
54{

Callers

nothing calls this directly

Calls 2

glGenBuffersFunction · 0.85
GetUsageMethod · 0.45

Tested by

no test coverage detected