glTexImage2D(texture_target, 0, texture_internal, width, height, 0, texture_format, texture_type, data);
}
+void Texture::downscale(unsigned int _lvl)
+{
+ glBindTexture(texture_target, handle);
+ glGenerateMipmap(texture_target);
+ glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ //glTexParameteri(texture_target, GL_TEXTURE_BASE_LEVEL, _lvl);
+}
+
unordered_map<string, Texture::texHandle> Texture::texture_Map;
unordered_map<unsigned int, Texture::texHandle*> Texture::handle_Map;
\ No newline at end of file
for (int i = 0; i < 2; i++)
{
blurPingPong[i] = new fBufferObject(1, false);
- blurPingPong[i]->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight());
+ blurPingPong[i]->bindBuffer(Graphix::getWindowWidth()/2, Graphix::getWindowHeight()/2);
}
shadowdir = new dBufferObject();
shadowdir->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight());
postRender = new fBufferObject(2, false);
- postRender->bindBuffer(Graphix::getWindowWidth(), Graphix::getWindowHeight());
+ postRender->bindBuffer(Graphix::getWindowWidth()/2, Graphix::getWindowHeight()/2);
fBufferObject::clearBuffer();
if (Graphix::testEffect(EF_BLOOM))
{
/* DRAW BRIGHTNESS */
+ glViewport(0, 0, Graphix::getWindowWidth() / 2, Graphix::getWindowHeight() / 2);
postRender->useBuffer();
+ render->getTexture()->downscale(1);
//glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
Shader::getShader(SH_BASICTEXTURE)->useShader();
/* BLUR BRIGHTNESS */
Shader::getShader(SH_BLUR)->useShader();
-
- for (int i = 0; i < 10; i++)
+ for (int i = 0; i < 4; i++)
{
blurPingPong[horizontal]->useBuffer();
- //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Shader::getShader(SH_BLUR)->setUniformLocation("uHorizontal", horizontal);
if (firstit)
+ {
postRender->getTexture(1)->useTexture();
+ firstit = false;
+ }
else
blurPingPong[!horizontal]->getTexture()->useTexture();
Model::getPlaneModel()->drawModel(mat4(1.f));
horizontal = !horizontal;
- if (firstit)
- firstit = false;
}
+ glViewport(0, 0, Graphix::getWindowWidth(), Graphix::getWindowHeight());
}
{
/* BLEND BRIGHTNESS TO ORIGINAL*/
Shader::getShader(SH_BLEND)->useShader();
+ //Shader::getShader(SH_BASICTEXTURE)->useShader();
+
fBufferObject::clearBuffer();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//SceneObjects.front()->gTexture()->useTexture();
//shadowdir->getTexture()->useTexture();
+
render->getTexture(0)->useTexture(uCOLOR);
+ //postRender->getTexture(1)->useTexture(uCOLOR);
blurPingPong[!horizontal]->getTexture()->useTexture(uBLEND);
Model::getPlaneModel()->drawModel(mat4(1.f));
}