add GLProgram#bind_attribute
This commit is contained in:
parent
6a22ae4ad4
commit
864c5c2930
@ -47,23 +47,26 @@ static VALUE GLProgram_attach_shader(VALUE self, VALUE gl_shader)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE GLProgram_bind_attribute(VALUE self, VALUE attr_name, VALUE index)
|
||||||
|
{
|
||||||
|
GLProgram * glprogram;
|
||||||
|
Data_Get_Struct(self, GLProgram, glprogram);
|
||||||
|
attr_name = rb_funcall(attr_name, rb_intern("to_s"), 0);
|
||||||
|
const char * attr_name_cstr = StringValueCStr(attr_name);
|
||||||
|
glBindAttribLocation(glprogram->id, NUM2UINT(index), attr_name_cstr);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
void GLProgram_Init()
|
void GLProgram_Init()
|
||||||
{
|
{
|
||||||
ruby_class = rb_define_class("GLProgram", rb_cObject);
|
ruby_class = rb_define_class("GLProgram", rb_cObject);
|
||||||
rb_define_singleton_method(ruby_class, "new", (VALUE(*)(...))GLProgram_new, -1);
|
rb_define_singleton_method(ruby_class, "new", (VALUE(*)(...))GLProgram_new, -1);
|
||||||
rb_define_method(ruby_class, "attach_shader", (VALUE(*)(...))GLProgram_attach_shader, 1);
|
rb_define_method(ruby_class, "attach_shader", (VALUE(*)(...))GLProgram_attach_shader, 1);
|
||||||
|
rb_define_method(ruby_class, "bind_attribute", (VALUE(*)(...))GLProgram_bind_attribute, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
GLProgram & GLProgram::bind_attribute(const char * attribute, GLuint index)
|
|
||||||
{
|
|
||||||
if (m_id > 0u)
|
|
||||||
{
|
|
||||||
glBindAttribLocation(m_id, index, attribute);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GLProgram::link()
|
bool GLProgram::link()
|
||||||
{
|
{
|
||||||
if (m_id == 0u)
|
if (m_id == 0u)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user