JoshKlint
02-20-2011, 10:08 AM
Is the functionality of the DrawBuffers2 extension made core in OpenGL 3.3+, under a different name? I am looking for an equivalent to the glEnableIndexedEXT() command, to tell the GPU which color attachments should be written to.
JoshKlint
02-20-2011, 12:12 PM
It's part of glDrawBuffers() now. Here is some example code that will clear the color bit of one color attachment, and then clear the other color attachments with a different color:
GLenum buffers[] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3, GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT5, GL_COLOR_ATTACHMENT6, GL_COLOR_ATTACHMENT7};
GLenum offsetbuffers[] = {GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3, GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT5, GL_COLOR_ATTACHMENT6, GL_COLOR_ATTACHMENT7};
//Clear color component 0 using the specified clear color
glDrawBuffers(1,buffers);
glClearColor(clearcolor.x,clearcolor.y,clearcolor. z,clearcolor.w);
glClear(clearflags);
//Set clear color to black and clear color component 1-7
glClearColor(0,0,0,0);
glDrawBuffers(gbuffer->CountColorTextures()-1,offsetbuffers);
glClear(GL_COLOR_BUFFER_BIT);
//Restore writing to all components
glDrawBuffers(gbuffer->CountColorTextures(),buffers);
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.