added singleton shader manager, custom widget attribute forward, parse border thickness and color for Border widget, parse and cache uniform locations, remove unused attrubutes code
This commit is contained in:
@@ -78,10 +78,10 @@ void App::init()
|
||||
layout.update(width, height);
|
||||
|
||||
sampler.create();
|
||||
shader.create(shader_v, shader_f);
|
||||
shader_color.create(shader_color_v, shader_color_f);
|
||||
shader_uv.create(shader_v, shader_uv_f);
|
||||
plane.create<5>(1, 1);
|
||||
ShaderManager::create(kShader::Texture, shader_v, shader_f);
|
||||
ShaderManager::create(kShader::Color, shader_color_v, shader_color_f);
|
||||
ShaderManager::create(kShader::UVs, shader_v, shader_uv_f);
|
||||
WidgetBorder::m_plane.create<1>(1, 1);
|
||||
|
||||
if (!tex.load("data/uvs.jpg"))
|
||||
printf("error loading image\n");
|
||||
@@ -118,10 +118,8 @@ void App::update(float dt)
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
tex.bind();
|
||||
sampler.bind(0);
|
||||
shader.use();
|
||||
shader.u_int("tex", 0);
|
||||
shader_color.use();
|
||||
shader_color.u_vec4("col", { .3f, .3f, .3f, 1 });
|
||||
ShaderManager::use(kShader::Texture);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
@@ -132,15 +130,7 @@ void App::update(float dt)
|
||||
|
||||
if (n.m_widget)
|
||||
{
|
||||
shader_color.u_vec4("col", n.color);
|
||||
shader_color.use();
|
||||
shader_color.u_mat4("mvp", n.m_widget->mvp);
|
||||
plane.draw_fill();
|
||||
|
||||
shader_color.u_vec4("col", { 1, 1, 1, 1 });
|
||||
shader_color.use();
|
||||
shader_color.u_mat4("mvp", n.m_widget->mvp);
|
||||
plane.draw_stroke();
|
||||
n.m_widget->draw();
|
||||
}
|
||||
}
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
Reference in New Issue
Block a user