TextureCache::setPrimaryDrawBuffers can take a Batch

This commit is contained in:
Atlante45 2015-05-16 04:25:51 +02:00
parent b11525debf
commit 4bb1b1a02f
2 changed files with 9 additions and 1 deletions

View file

@ -247,6 +247,12 @@ GLuint TextureCache::getPrimarySpecularTextureID() {
}
void TextureCache::setPrimaryDrawBuffers(bool color, bool normal, bool specular) {
gpu::Batch batch;
setPrimaryDrawBuffers(batch, color, normal, specular);
gpu::GLBackend::renderBatch(batch);
}
void TextureCache::setPrimaryDrawBuffers(gpu::Batch batch, bool color, bool normal, bool specular) {
GLenum buffers[3];
int bufferCount = 0;
if (color) {
@ -258,7 +264,7 @@ void TextureCache::setPrimaryDrawBuffers(bool color, bool normal, bool specular)
if (specular) {
buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;
}
glDrawBuffers(bufferCount, buffers);
batch._glDrawBuffers(bufferCount, buffers);
}
gpu::FramebufferPointer TextureCache::getSecondaryFramebuffer() {

View file

@ -12,6 +12,7 @@
#ifndef hifi_TextureCache_h
#define hifi_TextureCache_h
#include <gpu/Batch.h>
#include <gpu/GPUConfig.h>
#include <gpu/Texture.h>
#include <gpu/Framebuffer.h>
@ -78,6 +79,7 @@ public:
/// Enables or disables draw buffers on the primary framebuffer. Note: the primary framebuffer must be bound.
void setPrimaryDrawBuffers(bool color, bool normal = false, bool specular = false);
void setPrimaryDrawBuffers(gpu::Batch batch, bool color, bool normal = false, bool specular = false);
/// Returns a pointer to the secondary framebuffer object, used as an additional render target when performing full
/// screen effects.