clear new layers

This commit is contained in:
2017-04-15 21:52:18 +02:00
parent 163a435e6e
commit 357f37e3d0
4 changed files with 5 additions and 5 deletions

View File

@@ -641,7 +641,7 @@ bool App::mouse_scroll(float x, float y, float delta)
MouseEvent e; MouseEvent e;
e.m_type = kEventType::MouseScroll; e.m_type = kEventType::MouseScroll;
e.m_pos = { x / zoom, y / zoom }; e.m_pos = { x / zoom, y / zoom };
e.m_scroll_delta = delta; e.m_scroll_delta = delta * 0.1f;
auto ret = layout[main_id]->on_event(&e); auto ret = layout[main_id]->on_event(&e);
layout[main_id]->update(); layout[main_id]->update();
return ret == kEventResult::Consumed; return ret == kEventResult::Consumed;

View File

@@ -81,6 +81,9 @@ public:
bool create(int width, int height, std::string name) bool create(int width, int height, std::string name)
{ {
m_rtt.create(width, height); m_rtt.create(width, height);
m_rtt.bindFramebuffer();
m_rtt.clear();
m_rtt.unbindFramebuffer();
return true; return true;
} }
}; };

View File

@@ -229,7 +229,7 @@ void ui::Canvas::resize(int width, int height)
m_tex2.create(width, height); m_tex2.create(width, height);
for (auto& l : m_layers) for (auto& l : m_layers)
{ {
l.m_rtt.create(width, height); l.create(width, height, "");
} }
} }
bool ui::Canvas::create(int width, int height) bool ui::Canvas::create(int width, int height)

View File

@@ -1769,9 +1769,6 @@ public:
glGetIntegerv(GL_VIEWPORT, vp); glGetIntegerv(GL_VIEWPORT, vp);
glGetFloatv(GL_COLOR_CLEAR_VALUE, cc); glGetFloatv(GL_COLOR_CLEAR_VALUE, cc);
double w = (double)m_rtt.getWidth();
double h = (double)m_rtt.getHeight();
glClearColor(1, 1, 1, 1); glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, m_rtt.getWidth(), m_rtt.getHeight()); glViewport(0, 0, m_rtt.getWidth(), m_rtt.getHeight());