add GLShader_id()

This commit is contained in:
Josh Holtrop 2014-07-22 18:51:38 -04:00
parent 6aef5dab75
commit bd188f9e83
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,4 @@
#include "GLShader.h" #include "GLShader.h"
#include "ruby.h"
#include "gl3w.h"
typedef struct typedef struct
{ {
@ -95,5 +93,12 @@ void GLShader_Init()
{ {
ruby_class = rb_define_class("GLShader", rb_cObject); ruby_class = rb_define_class("GLShader", rb_cObject);
rb_define_singleton_method(ruby_class, "new", (VALUE(*)(...))GLShader_new, 2); rb_define_singleton_method(ruby_class, "new", (VALUE(*)(...))GLShader_new, 2);
rb_define_attr(ruby_class, "id", 0, 1); }
GLuint GLShader_id(VALUE shader)
{
GLShader * glshader;
Data_Get_Struct(shader, GLShader, glshader);
return glshader->id;
} }

View File

@ -1,6 +1,10 @@
#ifndef GLSHADER_H #ifndef GLSHADER_H
#define GLSHADER_H #define GLSHADER_H
#include "ruby.h"
#include "gl3w.h"
void GLShader_Init(); void GLShader_Init();
GLuint GLShader_id(VALUE shader);
#endif #endif