46 std::map<int, const char*> fbo_attachments;
48 fbo_attachments[GL_NONE] =
"GL_NONE";
49 fbo_attachments[GL_BACK_LEFT] =
"GL_BACK_LEFT";
50 fbo_attachments[GL_BACK_RIGHT] =
"GL_BACK_RIGHT";
51 fbo_attachments[GL_FRONT_LEFT] =
"GL_FRONT_LEFT";
52 fbo_attachments[GL_FRONT_RIGHT] =
"GL_FRONT_RIGHT";
53 fbo_attachments[GL_AUX0] =
"GL_AUX0";
54 fbo_attachments[GL_AUX1] =
"GL_AUX1";
55 fbo_attachments[GL_AUX2] =
"GL_AUX2";
56 fbo_attachments[GL_AUX3] =
"GL_AUX3";
57 fbo_attachments[GL_COLOR_ATTACHMENT0] =
"GL_COLOR_ATTACHMENT0";
58 fbo_attachments[GL_COLOR_ATTACHMENT1] =
"GL_COLOR_ATTACHMENT1";
59 fbo_attachments[GL_COLOR_ATTACHMENT2] =
"GL_COLOR_ATTACHMENT2";
60 fbo_attachments[GL_COLOR_ATTACHMENT3] =
"GL_COLOR_ATTACHMENT3";
61 fbo_attachments[GL_COLOR_ATTACHMENT4] =
"GL_COLOR_ATTACHMENT4";
62 fbo_attachments[GL_COLOR_ATTACHMENT5] =
"GL_COLOR_ATTACHMENT5";
63 fbo_attachments[GL_COLOR_ATTACHMENT6] =
"GL_COLOR_ATTACHMENT6";
64 fbo_attachments[GL_COLOR_ATTACHMENT7] =
"GL_COLOR_ATTACHMENT7";
65 fbo_attachments[GL_COLOR_ATTACHMENT8] =
"GL_COLOR_ATTACHMENT8";
66 fbo_attachments[GL_COLOR_ATTACHMENT9] =
"GL_COLOR_ATTACHMENT9";
67 fbo_attachments[GL_COLOR_ATTACHMENT10] =
"GL_COLOR_ATTACHMENT10";
68 fbo_attachments[GL_COLOR_ATTACHMENT11] =
"GL_COLOR_ATTACHMENT11";
69 fbo_attachments[GL_COLOR_ATTACHMENT12] =
"GL_COLOR_ATTACHMENT12";
70 fbo_attachments[GL_COLOR_ATTACHMENT13] =
"GL_COLOR_ATTACHMENT13";
71 fbo_attachments[GL_COLOR_ATTACHMENT14] =
"GL_COLOR_ATTACHMENT14";
72 fbo_attachments[GL_COLOR_ATTACHMENT15] =
"GL_COLOR_ATTACHMENT15";
75 if (Has_GL_EXT_framebuffer_object||Has_GL_ARB_framebuffer_object)
76 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo);
80 std::set<GLenum> legal;
81 legal.insert(GL_NONE);
82 legal.insert(GL_COLOR_ATTACHMENT0);
83 legal.insert(GL_COLOR_ATTACHMENT1);
84 legal.insert(GL_COLOR_ATTACHMENT2);
85 legal.insert(GL_COLOR_ATTACHMENT3);
86 legal.insert(GL_COLOR_ATTACHMENT4);
87 legal.insert(GL_COLOR_ATTACHMENT5);
88 legal.insert(GL_COLOR_ATTACHMENT6);
89 legal.insert(GL_COLOR_ATTACHMENT7);
90 legal.insert(GL_COLOR_ATTACHMENT8);
91 legal.insert(GL_COLOR_ATTACHMENT9);
92 legal.insert(GL_COLOR_ATTACHMENT10);
93 legal.insert(GL_COLOR_ATTACHMENT11);
94 legal.insert(GL_COLOR_ATTACHMENT12);
95 legal.insert(GL_COLOR_ATTACHMENT13);
96 legal.insert(GL_COLOR_ATTACHMENT14);
97 legal.insert(GL_COLOR_ATTACHMENT15);
98 for(
unsigned i=0; i<mDrawBuffers.size(); ++i)
100 if(legal.find(mDrawBuffers[i]) == legal.end())
102 Log::error(
Say(
"FBO bound but Framebuffer::setDrawBuffers() called with non FBO compatible draw buffer '%s'.\n") << fbo_attachments[mDrawBuffers[i]]);
109 std::set<GLenum> legal;
110 legal.insert(GL_NONE);
111 legal.insert(GL_BACK_LEFT);
112 legal.insert(GL_BACK_RIGHT);
113 legal.insert(GL_FRONT_LEFT);
114 legal.insert(GL_FRONT_RIGHT);
115 legal.insert(GL_AUX0);
116 legal.insert(GL_AUX1);
117 legal.insert(GL_AUX2);
118 legal.insert(GL_AUX3);
119 for(
unsigned i=0; i<mDrawBuffers.size(); ++i)
121 if(legal.find(mDrawBuffers[i]) == legal.end())
123 Log::error(
Say(
"FBO not bound or not supported but Framebuffer::setDrawBuffers() called with FBO specific draw buffer '%s'.\n") << fbo_attachments[mDrawBuffers[i]]);
143 glDrawBuffers( (GLsizei)mDrawBuffers.size(), (
const GLenum*)&mDrawBuffers[0] );
149 glDrawBuffer( mDrawBuffers[0] );
152 if ( mDrawBuffers.size() > 1 )
154 Log::error(
"Framebuffer::bindDrawBuffers() error:\nglDrawBuffers() not supported by the current OpenGL driver. GL_ARB_draw_buffers or OpenGL 2.0 required.\n" );
void bindReadBuffer()
Binds to the currently active framebuffer object (including the 0 one) the read buffer specified by s...
A simple String formatting class.
EReadDrawBuffer readBuffer() const
The read-buffer bound when the render target is activated.
void bindDrawBuffers() const
Binds to the currently active framebuffer object (including the 0 one) the draw buffers specified by ...
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
Visualization Library main namespace.
bool checkDrawBuffers() const
Returns true if the draw buffers bound to this render target are legal for this render target type...