void DeferredLightingEffect::prepare(RenderArgs* args) { // clear the normal and specular buffers auto textureCache = DependencyManager::get<TextureCache>(); textureCache->setPrimaryDrawBuffers(false, true, false); glClear(GL_COLOR_BUFFER_BIT); textureCache->setPrimaryDrawBuffers(false, false, true); // clearing to zero alpha for specular causes problems on my Nvidia card; clear to lowest non-zero value instead const float MAX_SPECULAR_EXPONENT = 128.0f; glClearColor(0.0f, 0.0f, 0.0f, 1.0f / MAX_SPECULAR_EXPONENT); glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); textureCache->setPrimaryDrawBuffers(true, false, false); }
void TextureCache::setPrimaryDrawBuffers(bool color, bool normal, bool specular) { gpu::Batch batch; setPrimaryDrawBuffers(batch, color, normal, specular); gpu::GLBackend::renderBatch(batch); }