add gltk.Program.bind_attrib_location()

This commit is contained in:
Josh Holtrop 2020-12-07 14:17:37 -05:00
parent 858ce9f7b1
commit b16d6fa43f
2 changed files with 6 additions and 1 deletions

View File

@ -26,6 +26,11 @@ class Program
glAttachShader(m_id, shader.id); glAttachShader(m_id, shader.id);
} }
void bind_attrib_location(uint index, string name)
{
glBindAttribLocation(m_id, index, name.toStringz());
}
void link() const void link() const
{ {
glLinkProgram(m_id); glLinkProgram(m_id);

View File

@ -50,7 +50,7 @@ class Gui
m_text_program = new gltk.Program(); m_text_program = new gltk.Program();
m_text_program.attach_shader(v_shader); m_text_program.attach_shader(v_shader);
m_text_program.attach_shader(f_shader); m_text_program.attach_shader(f_shader);
glBindAttribLocation(m_text_program.id, 0, "coords"); m_text_program.bind_attrib_location(0u, "coords");
m_text_program.link(); m_text_program.link();
m_viewport_size = m_text_program.get_uniform_location("viewport_size"); m_viewport_size = m_text_program.get_uniform_location("viewport_size");
m_texture = m_text_program.get_uniform_location("texture"); m_texture = m_text_program.get_uniform_location("texture");