|
@@ -8,8 +8,6 @@ CFBO::CFBO (std::string name, ITexture::TextureFormat format, float scale, uint3
|
|
|
m_scale (scale)
|
|
m_scale (scale)
|
|
|
{
|
|
{
|
|
|
// create an empty texture that'll be free'd so the FBO is transparent
|
|
// create an empty texture that'll be free'd so the FBO is transparent
|
|
|
- uint32_t* pixels = new uint32_t [textureWidth * textureHeight] {0xFFFFFFFF};
|
|
|
|
|
-
|
|
|
|
|
GLenum drawBuffers [1] = {GL_COLOR_ATTACHMENT0};
|
|
GLenum drawBuffers [1] = {GL_COLOR_ATTACHMENT0};
|
|
|
// create the main framebuffer
|
|
// create the main framebuffer
|
|
|
glGenFramebuffers (1, &this->m_framebuffer);
|
|
glGenFramebuffers (1, &this->m_framebuffer);
|
|
@@ -19,9 +17,7 @@ CFBO::CFBO (std::string name, ITexture::TextureFormat format, float scale, uint3
|
|
|
// bind the new texture to set settings on it
|
|
// bind the new texture to set settings on it
|
|
|
glBindTexture (GL_TEXTURE_2D, this->m_texture);
|
|
glBindTexture (GL_TEXTURE_2D, this->m_texture);
|
|
|
// give OpenGL an empty image
|
|
// give OpenGL an empty image
|
|
|
- glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
|
|
|
|
-
|
|
|
|
|
- delete pixels;
|
|
|
|
|
|
|
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
|
|
|
|
|
|
|
// set filtering parameters, otherwise the texture is not rendered
|
|
// set filtering parameters, otherwise the texture is not rendered
|
|
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
@@ -38,6 +34,9 @@ CFBO::CFBO (std::string name, ITexture::TextureFormat format, float scale, uint3
|
|
|
// ensure first framebuffer is okay
|
|
// ensure first framebuffer is okay
|
|
|
if (glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
|
if (glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
|
|
|
throw std::runtime_error ("Framebuffers are not properly set");
|
|
throw std::runtime_error ("Framebuffers are not properly set");
|
|
|
|
|
+
|
|
|
|
|
+ // clear the framebuffer
|
|
|
|
|
+ glClear (GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
|
|
this->m_resolution = {
|
|
this->m_resolution = {
|
|
|
textureWidth, textureHeight,
|
|
textureWidth, textureHeight,
|