link programs before getting uniform locations; add Widget#draw_rect; fix GL.draw_rect; store uniforms as GLint
This commit is contained in:
parent
7cc541ed29
commit
be8f71296f
@ -16,6 +16,7 @@ class GLProgram
|
|||||||
raise NotImplementedError.new("Other arguments not yet implemented")
|
raise NotImplementedError.new("Other arguments not yet implemented")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
link
|
||||||
options.each do |option, value|
|
options.each do |option, value|
|
||||||
case option
|
case option
|
||||||
when :uniforms
|
when :uniforms
|
||||||
@ -26,6 +27,5 @@ class GLProgram
|
|||||||
raise "Unknown option #{option.inspect}"
|
raise "Unknown option #{option.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
link
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -30,4 +30,8 @@ module Widget
|
|||||||
|
|
||||||
def render_end
|
def render_end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def draw_rect(x, y, width, height, r, g, b, a)
|
||||||
|
GL.draw_rect(@x + x, @y + y, width, height, r, g, b, a)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -46,7 +46,7 @@ void GL_Init()
|
|||||||
{
|
{
|
||||||
ruby_module = rb_define_module("GL");
|
ruby_module = rb_define_module("GL");
|
||||||
rb_define_singleton_method(ruby_module, "draw_rect",
|
rb_define_singleton_method(ruby_module, "draw_rect",
|
||||||
(VALUE(*)(...))GL_draw_rect, 4);
|
(VALUE(*)(...))GL_draw_rect, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_gl_buffers()
|
static void load_gl_buffers()
|
||||||
|
@ -17,7 +17,7 @@ enum
|
|||||||
struct GLProgram
|
struct GLProgram
|
||||||
{
|
{
|
||||||
GLuint id;
|
GLuint id;
|
||||||
std::unordered_map<int, GLuint> uniforms;
|
std::unordered_map<int, GLint> uniforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
void GLProgram_Init();
|
void GLProgram_Init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user