fix canvas on hdpi
This commit is contained in:
15
src/rtt.cpp
15
src/rtt.cpp
@@ -41,7 +41,7 @@ void RTT::resize(int width, int height)
|
||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldDFboID);
|
||||
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &oldRFboID);
|
||||
|
||||
new_rtt.create(width, height, -1, int_fmt);
|
||||
new_rtt.create(width, height, -1, int_fmt, rboID != 0);
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, new_rtt.fboID);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboID);
|
||||
@@ -100,7 +100,7 @@ void RTT::copy(const RTT & source)
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, oldRFboID);
|
||||
}
|
||||
|
||||
bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format)
|
||||
bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format, bool depth_buffer /*= false*/)
|
||||
{
|
||||
// Destroy any previously created object
|
||||
destroy();
|
||||
@@ -133,10 +133,13 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format)
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// Create a renderbuffer object to store depth info
|
||||
// glGenRenderbuffers(1, &rboID);
|
||||
// glBindRenderbuffer(GL_RENDERBUFFER, rboID);
|
||||
// glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
|
||||
// glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
if (depth_buffer)
|
||||
{
|
||||
glGenRenderbuffers(1, &rboID);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, rboID);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
GLint oldFboID;
|
||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFboID);
|
||||
|
||||
Reference in New Issue
Block a user