MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / enable

Method enable

examples/OpenGLWindow/GLRenderToTexture.cpp:62–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62bool GLRenderToTexture::enable()
63{
64 bool status = false;
65
66 glBindFramebuffer(GL_FRAMEBUFFER, m_framebufferName);
67
68 switch (m_renderTextureType)
69 {
70 case RENDERTEXTURE_COLOR:
71 {
72 // Set the list of draw buffers.
73 GLenum drawBuffers[2] = {GL_COLOR_ATTACHMENT0, 0};
74 glDrawBuffers(1, drawBuffers);
75 break;
76 }
77 case RENDERTEXTURE_DEPTH:
78 {
79 //Intel OpenGL driver crashes when using GL_NONE for glDrawBuffer on Linux, so use a workaround
80 if (gIntelLinuxglDrawBufferWorkaround)
81 {
82 GLenum drawBuffers[2] = {GL_COLOR_ATTACHMENT0, 0};
83 glDrawBuffers(1, drawBuffers);
84 }
85 else
86 {
87 glDrawBuffer(GL_NONE);
88 }
89 break;
90 }
91 default:
92 {
93 b3Assert(0);
94 }
95 };
96
97 // Always check that our framebuffer is ok
98 if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
99 {
100 status = true;
101 }
102
103 return status;
104}
105
106void GLRenderToTexture::disable()
107{

Callers 2

dumpNextFrameToPngMethod · 0.80
renderSceneInternalMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected