MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / Set

Method Set

cpp/5_Domain_Specific/smokeParticles/renderbuffer.cpp:76–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74void Renderbuffer::Unbind() { glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); }
75
76void Renderbuffer::Set(GLenum internalFormat, int width, int height)
77{
78 int maxSize = Renderbuffer::GetMaxSize();
79
80 if (width > maxSize || height > maxSize) {
81 cerr << "Renderbuffer::Renderbuffer() ERROR:\n\t"
82 << "Size too big (" << width << ", " << height << ")\n";
83 return;
84 }
85
86 // Guarded bind
87 GLint savedId = 0;
88 glGetIntegerv(GL_RENDERBUFFER_BINDING_EXT, &savedId);
89
90 if (savedId != (GLint)m_bufId) {
91 Bind();
92 }
93
94 // Allocate memory for renderBuffer
95 glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalFormat, width, height);
96
97 // Guarded unbind
98 if (savedId != (GLint)m_bufId) {
99 glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, savedId);
100 }
101}
102
103GLuint Renderbuffer::GetId() const { return m_bufId; }
104

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected