Module: GLNative

Defined in:
ext/gl_native/gl_native.c

Class Method Summary collapse

Class Method Details

.active_texture(texture) ⇒ Object

ActiveTexture(texture)



43
44
45
46
# File 'ext/gl_native/gl_native.c', line 43

static VALUE rb_gl_active_texture(VALUE self, VALUE texture) {
    glActiveTexture((GLenum)NUM2INT(texture));
    return Qnil;
}

.attach_shader(program, shader) ⇒ Object

AttachShader(program, shader)



148
149
150
151
# File 'ext/gl_native/gl_native.c', line 148

static VALUE rb_gl_attach_shader(VALUE self, VALUE program, VALUE shader) {
    glAttachShader((GLuint)NUM2UINT(program), (GLuint)NUM2UINT(shader));
    return Qnil;
}

.begin_query(target, id) ⇒ Object

BeginQuery(target, id)



154
155
156
157
# File 'ext/gl_native/gl_native.c', line 154

static VALUE rb_gl_begin_query(VALUE self, VALUE target, VALUE id) {
    glBeginQuery((GLenum)NUM2INT(target), (GLuint)NUM2UINT(id));
    return Qnil;
}

.bind_buffer(target, buffer) ⇒ Object

BindBuffer(target, buffer)



31
32
33
34
# File 'ext/gl_native/gl_native.c', line 31

static VALUE rb_gl_bind_buffer(VALUE self, VALUE target, VALUE buffer) {
    glBindBuffer((GLenum)NUM2INT(target), (GLuint)NUM2UINT(buffer));
    return Qnil;
}

.bind_framebuffer(target, framebuffer) ⇒ Object

BindFramebuffer(target, framebuffer)



19
20
21
22
# File 'ext/gl_native/gl_native.c', line 19

static VALUE rb_gl_bind_framebuffer(VALUE self, VALUE target, VALUE framebuffer) {
    glBindFramebuffer((GLenum)NUM2INT(target), (GLuint)NUM2UINT(framebuffer));
    return Qnil;
}

.bind_image_texture(unit, texture, level, layered, layer, access, format) ⇒ Object

BindImageTexture(unit, texture, level, layered, layer, access, format)



467
468
469
470
471
472
473
# File 'ext/gl_native/gl_native.c', line 467

static VALUE rb_gl_bind_image_texture(VALUE self, VALUE unit, VALUE texture, VALUE level,
                                       VALUE layered, VALUE layer, VALUE access, VALUE format) {
    glBindImageTexture((GLuint)NUM2UINT(unit), (GLuint)NUM2UINT(texture), (GLint)NUM2INT(level),
                       (GLboolean)NUM2INT(layered), (GLint)NUM2INT(layer),
                       (GLenum)NUM2INT(access), (GLenum)NUM2INT(format));
    return Qnil;
}

.bind_texture(target, texture) ⇒ Object

BindTexture(target, texture)



37
38
39
40
# File 'ext/gl_native/gl_native.c', line 37

static VALUE rb_gl_bind_texture(VALUE self, VALUE target, VALUE texture) {
    glBindTexture((GLenum)NUM2INT(target), (GLuint)NUM2UINT(texture));
    return Qnil;
}

.bind_vertex_array(array) ⇒ Object

BindVertexArray(array)



25
26
27
28
# File 'ext/gl_native/gl_native.c', line 25

static VALUE rb_gl_bind_vertex_array(VALUE self, VALUE array) {
    glBindVertexArray((GLuint)NUM2UINT(array));
    return Qnil;
}

.blend_func(sfactor, dfactor) ⇒ Object

BlendFunc(sfactor, dfactor)



160
161
162
163
# File 'ext/gl_native/gl_native.c', line 160

static VALUE rb_gl_blend_func(VALUE self, VALUE sfactor, VALUE dfactor) {
    glBlendFunc((GLenum)NUM2INT(sfactor), (GLenum)NUM2INT(dfactor));
    return Qnil;
}

.blit_framebuffer(src_x0, src_y0, src_x1, src_y1, dst_x0, dst_y0, dst_x1, dst_y1, mask, filter) ⇒ Object

BlitFramebuffer(…)



136
137
138
139
140
141
142
143
144
145
# File 'ext/gl_native/gl_native.c', line 136

static VALUE rb_gl_blit_framebuffer(VALUE self, VALUE src_x0, VALUE src_y0, VALUE src_x1, VALUE src_y1,
                                     VALUE dst_x0, VALUE dst_y0, VALUE dst_x1, VALUE dst_y1,
                                     VALUE mask, VALUE filter) {
    glBlitFramebuffer(
        (GLint)NUM2INT(src_x0), (GLint)NUM2INT(src_y0), (GLint)NUM2INT(src_x1), (GLint)NUM2INT(src_y1),
        (GLint)NUM2INT(dst_x0), (GLint)NUM2INT(dst_y0), (GLint)NUM2INT(dst_x1), (GLint)NUM2INT(dst_y1),
        (GLbitfield)NUM2UINT(mask), (GLenum)NUM2INT(filter)
    );
    return Qnil;
}

.buffer_data(target, size, data, usage) ⇒ Object

BufferData(target, size, data, usage)



166
167
168
169
170
# File 'ext/gl_native/gl_native.c', line 166

static VALUE rb_gl_buffer_data(VALUE self, VALUE target, VALUE size, VALUE data, VALUE usage) {
    const void *ptr = NIL_P(data) ? NULL : (const void *)RSTRING_PTR(data);
    glBufferData((GLenum)NUM2INT(target), (GLsizeiptr)NUM2LONG(size), ptr, (GLenum)NUM2INT(usage));
    return Qnil;
}

.buffer_sub_data(target, offset, size, data) ⇒ Object

BufferSubData(target, offset, size, data)



173
174
175
176
177
# File 'ext/gl_native/gl_native.c', line 173

static VALUE rb_gl_buffer_sub_data(VALUE self, VALUE target, VALUE offset, VALUE size, VALUE data) {
    const void *ptr = (const void *)RSTRING_PTR(data);
    glBufferSubData((GLenum)NUM2INT(target), (GLintptr)NUM2LONG(offset), (GLsizeiptr)NUM2LONG(size), ptr);
    return Qnil;
}

.check_framebuffer_status(target) ⇒ Object

CheckFramebufferStatus(target)



180
181
182
183
# File 'ext/gl_native/gl_native.c', line 180

static VALUE rb_gl_check_framebuffer_status(VALUE self, VALUE target) {
    GLenum result = glCheckFramebufferStatus((GLenum)NUM2INT(target));
    return INT2NUM(result);
}

.clear(mask) ⇒ Object

Clear(mask)



85
86
87
88
# File 'ext/gl_native/gl_native.c', line 85

static VALUE rb_gl_clear(VALUE self, VALUE mask) {
    glClear((GLbitfield)NUM2UINT(mask));
    return Qnil;
}

.clear_color(red, green, blue, alpha) ⇒ Object

ClearColor(red, green, blue, alpha)



186
187
188
189
# File 'ext/gl_native/gl_native.c', line 186

static VALUE rb_gl_clear_color(VALUE self, VALUE red, VALUE green, VALUE blue, VALUE alpha) {
    glClearColor((GLfloat)NUM2DBL(red), (GLfloat)NUM2DBL(green), (GLfloat)NUM2DBL(blue), (GLfloat)NUM2DBL(alpha));
    return Qnil;
}

.color_mask(red, green, blue, alpha) ⇒ Object

ColorMask(red, green, blue, alpha)



192
193
194
195
# File 'ext/gl_native/gl_native.c', line 192

static VALUE rb_gl_color_mask(VALUE self, VALUE red, VALUE green, VALUE blue, VALUE alpha) {
    glColorMask((GLboolean)NUM2INT(red), (GLboolean)NUM2INT(green), (GLboolean)NUM2INT(blue), (GLboolean)NUM2INT(alpha));
    return Qnil;
}

.compile_shader(shader) ⇒ Object

CompileShader(shader)



198
199
200
201
# File 'ext/gl_native/gl_native.c', line 198

static VALUE rb_gl_compile_shader(VALUE self, VALUE shader) {
    glCompileShader((GLuint)NUM2UINT(shader));
    return Qnil;
}

.create_programObject

CreateProgram()



204
205
206
207
# File 'ext/gl_native/gl_native.c', line 204

static VALUE rb_gl_create_program(VALUE self) {
    GLuint program = glCreateProgram();
    return UINT2NUM(program);
}

.create_shader(type) ⇒ Object

CreateShader(type)



210
211
212
213
# File 'ext/gl_native/gl_native.c', line 210

static VALUE rb_gl_create_shader(VALUE self, VALUE type) {
    GLuint shader = glCreateShader((GLenum)NUM2INT(type));
    return UINT2NUM(shader);
}

.cull_face(mode) ⇒ Object

CullFace(mode)



216
217
218
219
# File 'ext/gl_native/gl_native.c', line 216

static VALUE rb_gl_cull_face(VALUE self, VALUE mode) {
    glCullFace((GLenum)NUM2INT(mode));
    return Qnil;
}

.depth_func(func) ⇒ Object

DepthFunc(func)



222
223
224
225
# File 'ext/gl_native/gl_native.c', line 222

static VALUE rb_gl_depth_func(VALUE self, VALUE func) {
    glDepthFunc((GLenum)NUM2INT(func));
    return Qnil;
}

.disable(cap) ⇒ Object

Disable(cap)



61
62
63
64
# File 'ext/gl_native/gl_native.c', line 61

static VALUE rb_gl_disable(VALUE self, VALUE cap) {
    glDisable((GLenum)NUM2INT(cap));
    return Qnil;
}

.dispatch_compute(num_groups_x, num_groups_y, num_groups_z) ⇒ Object

DispatchCompute(num_groups_x, num_groups_y, num_groups_z)



476
477
478
479
# File 'ext/gl_native/gl_native.c', line 476

static VALUE rb_gl_dispatch_compute(VALUE self, VALUE num_groups_x, VALUE num_groups_y, VALUE num_groups_z) {
    glDispatchCompute((GLuint)NUM2UINT(num_groups_x), (GLuint)NUM2UINT(num_groups_y), (GLuint)NUM2UINT(num_groups_z));
    return Qnil;
}

.draw_arrays(mode, first, count) ⇒ Object

DrawArrays(mode, first, count)



67
68
69
70
# File 'ext/gl_native/gl_native.c', line 67

static VALUE rb_gl_draw_arrays(VALUE self, VALUE mode, VALUE first, VALUE count) {
    glDrawArrays((GLenum)NUM2INT(mode), (GLint)NUM2INT(first), (GLsizei)NUM2INT(count));
    return Qnil;
}

.draw_buffer(mode) ⇒ Object

DrawBuffer(mode)



228
229
230
231
# File 'ext/gl_native/gl_native.c', line 228

static VALUE rb_gl_draw_buffer(VALUE self, VALUE mode) {
    glDrawBuffer((GLenum)NUM2INT(mode));
    return Qnil;
}

.draw_buffers(n, bufs) ⇒ Object

DrawBuffers(n, bufs)



234
235
236
237
238
# File 'ext/gl_native/gl_native.c', line 234

static VALUE rb_gl_draw_buffers(VALUE self, VALUE n, VALUE bufs) {
    const GLenum *ptr = (const GLenum *)RSTRING_PTR(bufs);
    glDrawBuffers((GLsizei)NUM2INT(n), ptr);
    return Qnil;
}

.draw_elements(mode, count, type, indices) ⇒ Object

DrawElements(mode, count, type, indices)



73
74
75
76
# File 'ext/gl_native/gl_native.c', line 73

static VALUE rb_gl_draw_elements(VALUE self, VALUE mode, VALUE count, VALUE type, VALUE indices) {
    glDrawElements((GLenum)NUM2INT(mode), (GLsizei)NUM2INT(count), (GLenum)NUM2INT(type), (const void*)(uintptr_t)NUM2ULL(indices));
    return Qnil;
}

.draw_elements_instanced(mode, count, type, indices, instance_count) ⇒ Object

DrawElementsInstanced(mode, count, type, indices, instance_count)



79
80
81
82
# File 'ext/gl_native/gl_native.c', line 79

static VALUE rb_gl_draw_elements_instanced(VALUE self, VALUE mode, VALUE count, VALUE type, VALUE indices, VALUE instance_count) {
    glDrawElementsInstanced((GLenum)NUM2INT(mode), (GLsizei)NUM2INT(count), (GLenum)NUM2INT(type), (const void*)(uintptr_t)NUM2ULL(indices), (GLsizei)NUM2INT(instance_count));
    return Qnil;
}

.enable(cap) ⇒ Object

Enable(cap)



55
56
57
58
# File 'ext/gl_native/gl_native.c', line 55

static VALUE rb_gl_enable(VALUE self, VALUE cap) {
    glEnable((GLenum)NUM2INT(cap));
    return Qnil;
}

.enable_vertex_attrib_array(index) ⇒ Object

EnableVertexAttribArray(index)



241
242
243
244
# File 'ext/gl_native/gl_native.c', line 241

static VALUE rb_gl_enable_vertex_attrib_array(VALUE self, VALUE index) {
    glEnableVertexAttribArray((GLuint)NUM2UINT(index));
    return Qnil;
}

.end_query(target) ⇒ Object

EndQuery(target)



247
248
249
250
# File 'ext/gl_native/gl_native.c', line 247

static VALUE rb_gl_end_query(VALUE self, VALUE target) {
    glEndQuery((GLenum)NUM2INT(target));
    return Qnil;
}

.finishObject

Finish()



253
254
255
256
# File 'ext/gl_native/gl_native.c', line 253

static VALUE rb_gl_finish(VALUE self) {
    glFinish();
    return Qnil;
}

.framebuffer_texture_2d(target, attachment, textarget, texture, level) ⇒ Object

FramebufferTexture2D(target, attachment, textarget, texture, level)



259
260
261
262
# File 'ext/gl_native/gl_native.c', line 259

static VALUE rb_gl_framebuffer_texture_2d(VALUE self, VALUE target, VALUE attachment, VALUE textarget, VALUE texture, VALUE level) {
    glFramebufferTexture2D((GLenum)NUM2INT(target), (GLenum)NUM2INT(attachment), (GLenum)NUM2INT(textarget), (GLuint)NUM2UINT(texture), (GLint)NUM2INT(level));
    return Qnil;
}

.framebuffer_texture_layer(target, attachment, texture, level, layer) ⇒ Object

FramebufferTextureLayer(target, attachment, texture, level, layer)



265
266
267
268
# File 'ext/gl_native/gl_native.c', line 265

static VALUE rb_gl_framebuffer_texture_layer(VALUE self, VALUE target, VALUE attachment, VALUE texture, VALUE level, VALUE layer) {
    glFramebufferTextureLayer((GLenum)NUM2INT(target), (GLenum)NUM2INT(attachment), (GLuint)NUM2UINT(texture), (GLint)NUM2INT(level), (GLint)NUM2INT(layer));
    return Qnil;
}

.gen_buffers(n, buffers) ⇒ Object

GenBuffers(n, buffers)



271
272
273
274
275
# File 'ext/gl_native/gl_native.c', line 271

static VALUE rb_gl_gen_buffers(VALUE self, VALUE n, VALUE buffers) {
    GLuint *ptr = (GLuint *)RSTRING_PTR(buffers);
    glGenBuffers((GLsizei)NUM2INT(n), ptr);
    return Qnil;
}

.gen_framebuffers(n, framebuffers) ⇒ Object

GenFramebuffers(n, framebuffers)



284
285
286
287
288
# File 'ext/gl_native/gl_native.c', line 284

static VALUE rb_gl_gen_framebuffers(VALUE self, VALUE n, VALUE framebuffers) {
    GLuint *ptr = (GLuint *)RSTRING_PTR(framebuffers);
    glGenFramebuffers((GLsizei)NUM2INT(n), ptr);
    return Qnil;
}

.gen_queries(n, ids) ⇒ Object

GenQueries(n, ids)



291
292
293
294
295
# File 'ext/gl_native/gl_native.c', line 291

static VALUE rb_gl_gen_queries(VALUE self, VALUE n, VALUE ids) {
    GLuint *ptr = (GLuint *)RSTRING_PTR(ids);
    glGenQueries((GLsizei)NUM2INT(n), ptr);
    return Qnil;
}

.gen_textures(n, textures) ⇒ Object

GenTextures(n, textures)



298
299
300
301
302
# File 'ext/gl_native/gl_native.c', line 298

static VALUE rb_gl_gen_textures(VALUE self, VALUE n, VALUE textures) {
    GLuint *ptr = (GLuint *)RSTRING_PTR(textures);
    glGenTextures((GLsizei)NUM2INT(n), ptr);
    return Qnil;
}

.gen_vertex_arrays(n, arrays) ⇒ Object

GenVertexArrays(n, arrays)



305
306
307
308
309
# File 'ext/gl_native/gl_native.c', line 305

static VALUE rb_gl_gen_vertex_arrays(VALUE self, VALUE n, VALUE arrays) {
    GLuint *ptr = (GLuint *)RSTRING_PTR(arrays);
    glGenVertexArrays((GLsizei)NUM2INT(n), ptr);
    return Qnil;
}

.generate_mipmap(target) ⇒ Object

GenerateMipmap(target)



278
279
280
281
# File 'ext/gl_native/gl_native.c', line 278

static VALUE rb_gl_generate_mipmap(VALUE self, VALUE target) {
    glGenerateMipmap((GLenum)NUM2INT(target));
    return Qnil;
}

.get_errorObject

GetError()



312
313
314
315
# File 'ext/gl_native/gl_native.c', line 312

static VALUE rb_gl_get_error(VALUE self) {
    GLenum error = glGetError();
    return INT2NUM(error);
}

.get_program_info_log(program, max_length, length, info_log) ⇒ Object

GetProgramInfoLog(program, max_length, length, info_log)



318
319
320
321
322
323
# File 'ext/gl_native/gl_native.c', line 318

static VALUE rb_gl_get_program_info_log(VALUE self, VALUE program, VALUE max_length, VALUE length, VALUE info_log) {
    GLsizei *len_ptr = (GLsizei *)RSTRING_PTR(length);
    GLchar *log_ptr = (GLchar *)RSTRING_PTR(info_log);
    glGetProgramInfoLog((GLuint)NUM2UINT(program), (GLsizei)NUM2INT(max_length), len_ptr, log_ptr);
    return Qnil;
}

.get_programiv(program, pname, params) ⇒ Object

GetProgramiv(program, pname, params)



326
327
328
329
330
# File 'ext/gl_native/gl_native.c', line 326

static VALUE rb_gl_get_programiv(VALUE self, VALUE program, VALUE pname, VALUE params) {
    GLint *ptr = (GLint *)RSTRING_PTR(params);
    glGetProgramiv((GLuint)NUM2UINT(program), (GLenum)NUM2INT(pname), ptr);
    return Qnil;
}

.get_query_objectui64v(id, pname, params) ⇒ Object

GetQueryObjectui64v(id, pname, params)



333
334
335
336
337
# File 'ext/gl_native/gl_native.c', line 333

static VALUE rb_gl_get_query_objectui64v(VALUE self, VALUE id, VALUE pname, VALUE params) {
    GLuint64 *ptr = (GLuint64 *)RSTRING_PTR(params);
    glGetQueryObjectui64v((GLuint)NUM2UINT(id), (GLenum)NUM2INT(pname), ptr);
    return Qnil;
}

.get_shader_info_log(shader, max_length, length, info_log) ⇒ Object

GetShaderInfoLog(shader, max_length, length, info_log)



340
341
342
343
344
345
# File 'ext/gl_native/gl_native.c', line 340

static VALUE rb_gl_get_shader_info_log(VALUE self, VALUE shader, VALUE max_length, VALUE length, VALUE info_log) {
    GLsizei *len_ptr = (GLsizei *)RSTRING_PTR(length);
    GLchar *log_ptr = (GLchar *)RSTRING_PTR(info_log);
    glGetShaderInfoLog((GLuint)NUM2UINT(shader), (GLsizei)NUM2INT(max_length), len_ptr, log_ptr);
    return Qnil;
}

.get_string(name) ⇒ Object

GetString(name)



348
349
350
351
352
# File 'ext/gl_native/gl_native.c', line 348

static VALUE rb_gl_get_string(VALUE self, VALUE name) {
    const GLubyte *str = glGetString((GLenum)NUM2INT(name));
    if (str == NULL) return Qnil;
    return rb_str_new2((const char *)str);
}

.get_uniform_location(program, name) ⇒ Object

GetUniformLocation(program, name)



355
356
357
358
359
# File 'ext/gl_native/gl_native.c', line 355

static VALUE rb_gl_get_uniform_location(VALUE self, VALUE program, VALUE name) {
    const char *name_str = StringValueCStr(name);
    GLint location = glGetUniformLocation((GLuint)NUM2UINT(program), name_str);
    return INT2NUM(location);
}

LinkProgram(program)



362
363
364
365
# File 'ext/gl_native/gl_native.c', line 362

static VALUE rb_gl_link_program(VALUE self, VALUE program) {
    glLinkProgram((GLuint)NUM2UINT(program));
    return Qnil;
}

.memory_barrier(barriers) ⇒ Object

MemoryBarrier(barriers)



482
483
484
485
# File 'ext/gl_native/gl_native.c', line 482

static VALUE rb_gl_memory_barrier(VALUE self, VALUE barriers) {
    glMemoryBarrier((GLbitfield)NUM2UINT(barriers));
    return Qnil;
}

.read_buffer(mode) ⇒ Object

ReadBuffer(mode)



368
369
370
371
# File 'ext/gl_native/gl_native.c', line 368

static VALUE rb_gl_read_buffer(VALUE self, VALUE mode) {
    glReadBuffer((GLenum)NUM2INT(mode));
    return Qnil;
}

.read_pixels(x, y, width, height, format, type, data) ⇒ Object

ReadPixels(x, y, width, height, format, type, data)



374
375
376
377
378
# File 'ext/gl_native/gl_native.c', line 374

static VALUE rb_gl_read_pixels(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height, VALUE format, VALUE type, VALUE data) {
    void *ptr = (void *)RSTRING_PTR(data);
    glReadPixels((GLint)NUM2INT(x), (GLint)NUM2INT(y), (GLsizei)NUM2INT(width), (GLsizei)NUM2INT(height), (GLenum)NUM2INT(format), (GLenum)NUM2INT(type), ptr);
    return Qnil;
}

.shader_source(shader, count, string, length) ⇒ Object

ShaderSource(shader, count, string, length)



381
382
383
384
385
386
387
388
# File 'ext/gl_native/gl_native.c', line 381

static VALUE rb_gl_shader_source(VALUE self, VALUE shader, VALUE count, VALUE string, VALUE length) {
    /* string is a packed pointer array (from Ruby's pack('p')) */
    /* length is a packed int array (from Ruby's pack('I')) */
    const GLchar **src_ptr = (const GLchar **)RSTRING_PTR(string);
    const GLint *len_ptr = NIL_P(length) ? NULL : (const GLint *)RSTRING_PTR(length);
    glShaderSource((GLuint)NUM2UINT(shader), (GLsizei)NUM2INT(count), src_ptr, len_ptr);
    return Qnil;
}

.stencil_func(func, ref, mask) ⇒ Object

StencilFunc(func, ref, mask)



391
392
393
394
# File 'ext/gl_native/gl_native.c', line 391

static VALUE rb_gl_stencil_func(VALUE self, VALUE func, VALUE ref, VALUE mask) {
    glStencilFunc((GLenum)NUM2INT(func), (GLint)NUM2INT(ref), (GLuint)NUM2UINT(mask));
    return Qnil;
}

.stencil_mask(mask) ⇒ Object

StencilMask(mask)



397
398
399
400
# File 'ext/gl_native/gl_native.c', line 397

static VALUE rb_gl_stencil_mask(VALUE self, VALUE mask) {
    glStencilMask((GLuint)NUM2UINT(mask));
    return Qnil;
}

.stencil_op(sfail, dpfail, dppass) ⇒ Object

StencilOp(sfail, dpfail, dppass)



403
404
405
406
# File 'ext/gl_native/gl_native.c', line 403

static VALUE rb_gl_stencil_op(VALUE self, VALUE sfail, VALUE dpfail, VALUE dppass) {
    glStencilOp((GLenum)NUM2INT(sfail), (GLenum)NUM2INT(dpfail), (GLenum)NUM2INT(dppass));
    return Qnil;
}

.tex_image_2d(target, level, internalformat, width, height, border, format, type, data) ⇒ Object

TexImage2D(target, level, internalformat, width, height, border, format, type, data)



409
410
411
412
413
414
415
416
417
# File 'ext/gl_native/gl_native.c', line 409

static VALUE rb_gl_tex_image_2d(VALUE self, VALUE target, VALUE level, VALUE internalformat,
                                 VALUE width, VALUE height, VALUE border, VALUE format,
                                 VALUE type, VALUE data) {
    const void *ptr = NIL_P(data) ? NULL : (const void *)RSTRING_PTR(data);
    glTexImage2D((GLenum)NUM2INT(target), (GLint)NUM2INT(level), (GLint)NUM2INT(internalformat),
                 (GLsizei)NUM2INT(width), (GLsizei)NUM2INT(height), (GLint)NUM2INT(border),
                 (GLenum)NUM2INT(format), (GLenum)NUM2INT(type), ptr);
    return Qnil;
}

.tex_image_3d(target, level, internalformat, width, height, depth, border, format, type, data) ⇒ Object

TexImage3D(target, level, internalformat, width, height, depth, border, format, type, data)



420
421
422
423
424
425
426
427
428
# File 'ext/gl_native/gl_native.c', line 420

static VALUE rb_gl_tex_image_3d(VALUE self, VALUE target, VALUE level, VALUE internalformat,
                                 VALUE width, VALUE height, VALUE depth, VALUE border,
                                 VALUE format, VALUE type, VALUE data) {
    const void *ptr = NIL_P(data) ? NULL : (const void *)RSTRING_PTR(data);
    glTexImage3D((GLenum)NUM2INT(target), (GLint)NUM2INT(level), (GLint)NUM2INT(internalformat),
                 (GLsizei)NUM2INT(width), (GLsizei)NUM2INT(height), (GLsizei)NUM2INT(depth),
                 (GLint)NUM2INT(border), (GLenum)NUM2INT(format), (GLenum)NUM2INT(type), ptr);
    return Qnil;
}

.tex_parameterfv(target, pname, params) ⇒ Object

TexParameterfv(target, pname, params)



431
432
433
434
435
# File 'ext/gl_native/gl_native.c', line 431

static VALUE rb_gl_tex_parameterfv(VALUE self, VALUE target, VALUE pname, VALUE params) {
    const GLfloat *ptr = (const GLfloat *)RSTRING_PTR(params);
    glTexParameterfv((GLenum)NUM2INT(target), (GLenum)NUM2INT(pname), ptr);
    return Qnil;
}

.tex_parameteri(target, pname, param) ⇒ Object

TexParameteri(target, pname, param)



438
439
440
441
# File 'ext/gl_native/gl_native.c', line 438

static VALUE rb_gl_tex_parameteri(VALUE self, VALUE target, VALUE pname, VALUE param) {
    glTexParameteri((GLenum)NUM2INT(target), (GLenum)NUM2INT(pname), (GLint)NUM2INT(param));
    return Qnil;
}

.uniform1f(location, v0) ⇒ Object

Uniform1f(location, v0)



97
98
99
100
# File 'ext/gl_native/gl_native.c', line 97

static VALUE rb_gl_uniform1f(VALUE self, VALUE location, VALUE v0) {
    glUniform1f((GLint)NUM2INT(location), (GLfloat)NUM2DBL(v0));
    return Qnil;
}

.uniform1i(location, v0) ⇒ Object

Uniform1i(location, v0)



121
122
123
124
# File 'ext/gl_native/gl_native.c', line 121

static VALUE rb_gl_uniform1i(VALUE self, VALUE location, VALUE v0) {
    glUniform1i((GLint)NUM2INT(location), (GLint)NUM2INT(v0));
    return Qnil;
}

.uniform2f(location, v0, v1) ⇒ Object

Uniform2f(location, v0, v1)



103
104
105
106
# File 'ext/gl_native/gl_native.c', line 103

static VALUE rb_gl_uniform2f(VALUE self, VALUE location, VALUE v0, VALUE v1) {
    glUniform2f((GLint)NUM2INT(location), (GLfloat)NUM2DBL(v0), (GLfloat)NUM2DBL(v1));
    return Qnil;
}

.uniform3f(location, v0, v1, v2) ⇒ Object

Uniform3f(location, v0, v1, v2)



109
110
111
112
# File 'ext/gl_native/gl_native.c', line 109

static VALUE rb_gl_uniform3f(VALUE self, VALUE location, VALUE v0, VALUE v1, VALUE v2) {
    glUniform3f((GLint)NUM2INT(location), (GLfloat)NUM2DBL(v0), (GLfloat)NUM2DBL(v1), (GLfloat)NUM2DBL(v2));
    return Qnil;
}

.uniform4f(location, v0, v1, v2, v3) ⇒ Object

Uniform4f(location, v0, v1, v2, v3)



115
116
117
118
# File 'ext/gl_native/gl_native.c', line 115

static VALUE rb_gl_uniform4f(VALUE self, VALUE location, VALUE v0, VALUE v1, VALUE v2, VALUE v3) {
    glUniform4f((GLint)NUM2INT(location), (GLfloat)NUM2DBL(v0), (GLfloat)NUM2DBL(v1), (GLfloat)NUM2DBL(v2), (GLfloat)NUM2DBL(v3));
    return Qnil;
}

.uniform_matrix4fv(location, count, transpose, value) ⇒ Object

UniformMatrix4fv(location, count, transpose, value)



127
128
129
130
131
132
133
# File 'ext/gl_native/gl_native.c', line 127

static VALUE rb_gl_uniform_matrix4fv(VALUE self, VALUE location, VALUE count, VALUE transpose, VALUE value) {
    /* value should be a String containing packed floats */
    Check_Type(value, T_STRING);
    const GLfloat *data = (const GLfloat *)RSTRING_PTR(value);
    glUniformMatrix4fv((GLint)NUM2INT(location), (GLsizei)NUM2INT(count), (GLboolean)NUM2INT(transpose), data);
    return Qnil;
}

.use_program(program) ⇒ Object

UseProgram(program)



49
50
51
52
# File 'ext/gl_native/gl_native.c', line 49

static VALUE rb_gl_use_program(VALUE self, VALUE program) {
    glUseProgram((GLuint)NUM2UINT(program));
    return Qnil;
}

.vertex_attrib_divisor(index, divisor) ⇒ Object

VertexAttribDivisor(index, divisor)



444
445
446
447
# File 'ext/gl_native/gl_native.c', line 444

static VALUE rb_gl_vertex_attrib_divisor(VALUE self, VALUE index, VALUE divisor) {
    glVertexAttribDivisor((GLuint)NUM2UINT(index), (GLuint)NUM2UINT(divisor));
    return Qnil;
}

.vertex_attrib_ipointer(index, size, type, stride, pointer) ⇒ Object

VertexAttribIPointer(index, size, type, stride, pointer)



450
451
452
453
454
# File 'ext/gl_native/gl_native.c', line 450

static VALUE rb_gl_vertex_attrib_ipointer(VALUE self, VALUE index, VALUE size, VALUE type, VALUE stride, VALUE pointer) {
    glVertexAttribIPointer((GLuint)NUM2UINT(index), (GLint)NUM2INT(size), (GLenum)NUM2INT(type),
                           (GLsizei)NUM2INT(stride), (const void *)(uintptr_t)NUM2ULL(pointer));
    return Qnil;
}

.vertex_attrib_pointer(index, size, type, normalized, stride, pointer) ⇒ Object

VertexAttribPointer(index, size, type, normalized, stride, pointer)



457
458
459
460
461
462
# File 'ext/gl_native/gl_native.c', line 457

static VALUE rb_gl_vertex_attrib_pointer(VALUE self, VALUE index, VALUE size, VALUE type, VALUE normalized, VALUE stride, VALUE pointer) {
    glVertexAttribPointer((GLuint)NUM2UINT(index), (GLint)NUM2INT(size), (GLenum)NUM2INT(type),
                          (GLboolean)NUM2INT(normalized), (GLsizei)NUM2INT(stride),
                          (const void *)(uintptr_t)NUM2ULL(pointer));
    return Qnil;
}

.viewport(x, y, width, height) ⇒ Object

Viewport(x, y, width, height)



91
92
93
94
# File 'ext/gl_native/gl_native.c', line 91

static VALUE rb_gl_viewport(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height) {
    glViewport((GLint)NUM2INT(x), (GLint)NUM2INT(y), (GLsizei)NUM2INT(width), (GLsizei)NUM2INT(height));
    return Qnil;
}