fix export blending issue (just disabled blend in equirectangular drawing), and cleanup a bit
This commit is contained in:
@@ -62,7 +62,7 @@ void App::init()
|
|||||||
{ GL_DEBUG_SEVERITY_MEDIUM, FOREGROUND_GREEN | FOREGROUND_INTENSITY },
|
{ GL_DEBUG_SEVERITY_MEDIUM, FOREGROUND_GREEN | FOREGROUND_INTENSITY },
|
||||||
{ GL_DEBUG_SEVERITY_HIGH, FOREGROUND_RED | FOREGROUND_INTENSITY },
|
{ GL_DEBUG_SEVERITY_HIGH, FOREGROUND_RED | FOREGROUND_INTENSITY },
|
||||||
};
|
};
|
||||||
if (severity == GL_DEBUG_SEVERITY_MEDIUM || severity == GL_DEBUG_SEVERITY_HIGH || severity == GL_DEBUG_SEVERITY_LOW)
|
if (severity == GL_DEBUG_SEVERITY_HIGH || severity == GL_DEBUG_SEVERITY_MEDIUM || severity == GL_DEBUG_SEVERITY_LOW)
|
||||||
{
|
{
|
||||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colors[severity]);
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), colors[severity]);
|
||||||
LOG("OPENGL: %.*s", length, message);
|
LOG("OPENGL: %.*s", length, message);
|
||||||
|
|||||||
@@ -75,33 +75,21 @@ void ui::Canvas::pick_update(int plane)
|
|||||||
m_tmp[i].bindFramebuffer();
|
m_tmp[i].bindFramebuffer();
|
||||||
m_tmp[i].clear({ 1, 1, 1, 1 });
|
m_tmp[i].clear({ 1, 1, 1, 1 });
|
||||||
|
|
||||||
|
ShaderManager::use(ui::kShader::TextureAlpha);
|
||||||
|
ShaderManager::u_int(kShaderUniform::Highlight, false);
|
||||||
|
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||||
|
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
m_sampler.bind(0);
|
||||||
for (auto layer_index : m_order)
|
for (auto layer_index : m_order)
|
||||||
{
|
{
|
||||||
// copy to tmp2 for layer blending
|
|
||||||
glActiveTexture(GL_TEXTURE0); // TODO: maybe remove this line
|
|
||||||
// #ifndef __IOS__
|
|
||||||
// m_tex2[i].bind();
|
|
||||||
// glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, m_width, m_height);
|
|
||||||
// m_tex2[i].unbind();
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
m_layers[layer_index].m_rtt[i].bindTexture();
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
|
||||||
m_tex2[i].bind();
|
|
||||||
m_sampler.bind(0);
|
|
||||||
m_sampler_bg.bind(1);
|
|
||||||
ShaderManager::use(ui::kShader::TextureAlpha);
|
|
||||||
ShaderManager::u_int(kShaderUniform::TexBG, 1);
|
|
||||||
ShaderManager::u_float(kShaderUniform::Alpha, m_layers[layer_index].m_opacity);
|
ShaderManager::u_float(kShaderUniform::Alpha, m_layers[layer_index].m_opacity);
|
||||||
ShaderManager::u_int(kShaderUniform::Highlight, false);
|
m_layers[layer_index].m_rtt[i].bindTexture();
|
||||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
|
||||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho(-.5f, .5f, -.5f, .5f, -1.f, 1.f));
|
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
m_sampler.unbind();
|
|
||||||
m_sampler_bg.unbind();
|
|
||||||
m_tex2[i].unbind();
|
|
||||||
m_layers[layer_index].m_rtt[i].unbindTexture();
|
m_layers[layer_index].m_rtt[i].unbindTexture();
|
||||||
}
|
}
|
||||||
|
m_sampler.unbind();
|
||||||
|
|
||||||
if (!m_pick_data[plane])
|
if (!m_pick_data[plane])
|
||||||
m_pick_data[plane] = std::make_unique<glm::u8vec4[]>(m_width*m_height);
|
m_pick_data[plane] = std::make_unique<glm::u8vec4[]>(m_width*m_height);
|
||||||
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_pick_data[plane].get());
|
glReadPixels(0, 0, m_width, m_height, GL_RGBA, GL_UNSIGNED_BYTE, m_pick_data[plane].get());
|
||||||
@@ -811,16 +799,17 @@ void ui::Canvas::export_equirectangular(std::string data_path)
|
|||||||
m_tmp[i].unbindFramebuffer();
|
m_tmp[i].unbindFramebuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// auto data = std::make_unique<uint8_t[]>(m_tmp[0].bytes());
|
//auto data = std::make_unique<uint8_t[]>(m_tmp[0].bytes());
|
||||||
// for (int i = 0; i < 6; i++)
|
//for (int i = 0; i < 1; i++)
|
||||||
// {
|
//{
|
||||||
// m_tmp[i].readTextureData(data.get());
|
// m_tmp[i].readTextureData(data.get());
|
||||||
// static char name[128];
|
// static char name[128];
|
||||||
// sprintf(name, "%s/Face%d.png", data_path.c_str(), i);
|
// sprintf(name, "%s/Face%d.png", data_path.c_str(), i);
|
||||||
// LOG("writing %s", name);
|
// LOG("writing %s", name);
|
||||||
// int ret = stbi_write_png(name, m_tmp[i].getWidth(), m_tmp[i].getHeight(), 4, data.get(), m_tmp[i].stride());
|
// int ret = stbi_write_png(name, m_tmp[i].getWidth(), m_tmp[i].getHeight(), 4, data.get(), m_tmp[i].stride());
|
||||||
// }
|
//}
|
||||||
|
|
||||||
|
glDisable(GL_BLEND);
|
||||||
glViewport(0, 0, m_latlong.getWidth(), m_latlong.getHeight());
|
glViewport(0, 0, m_latlong.getWidth(), m_latlong.getHeight());
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
m_latlong.bindFramebuffer();
|
m_latlong.bindFramebuffer();
|
||||||
|
|||||||
@@ -366,23 +366,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
|||||||
App::I.key_char((int)wp);
|
App::I.key_char((int)wp);
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
App::I.mouse_move((float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure());
|
//TODO: find a way to check if event is mouse/stylus. For now use Mouse for all
|
||||||
|
App::I.mouse_move((float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure(), kEventSource::Mouse);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
App::I.mouse_down(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure());
|
//TODO: find a way to check if event is mouse/stylus. For now use Mouse for all
|
||||||
|
App::I.mouse_down(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), WacomTablet::I.get_pressure(), kEventSource::Mouse);
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
break;
|
break;
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
WacomTablet::I.reset_pressure();
|
WacomTablet::I.reset_pressure();
|
||||||
App::I.mouse_up(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp));
|
//TODO: find a way to check if event is mouse/stylus. For now use Mouse for all
|
||||||
|
App::I.mouse_up(0, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), kEventSource::Mouse);
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
App::I.mouse_down(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), 1.f);
|
App::I.mouse_down(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), 1.f, kEventSource::Mouse);
|
||||||
SetCapture(hWnd);
|
SetCapture(hWnd);
|
||||||
break;
|
break;
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
App::I.mouse_up(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp));
|
App::I.mouse_up(1, (float)GET_X_LPARAM(lp), (float)GET_Y_LPARAM(lp), kEventSource::Mouse);
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
break;
|
break;
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
class WacomTablet
|
class WacomTablet
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
HCTX g_hCtx = NULL;
|
HCTX g_hCtx = NULL;
|
||||||
AXIS TabletPressure = { 0 };
|
AXIS TabletPressure = { 0 };
|
||||||
LOGCONTEXTA glogContext = { 0 };
|
LOGCONTEXTA glogContext = { 0 };
|
||||||
@@ -19,7 +20,7 @@ class WacomTablet
|
|||||||
bool m_mouse_down = false;
|
bool m_mouse_down = false;
|
||||||
|
|
||||||
HCTX TabletInit(HWND hWnd);
|
HCTX TabletInit(HWND hWnd);
|
||||||
public:
|
|
||||||
static WacomTablet I;
|
static WacomTablet I;
|
||||||
bool init(HWND hWnd);
|
bool init(HWND hWnd);
|
||||||
void terminate();
|
void terminate();
|
||||||
|
|||||||
Reference in New Issue
Block a user