opengl3 0.0.1.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +87 -0
- data/Rakefile +17 -0
- data/examples/math3d.rb +65 -0
- data/examples/ogl-2_1-basic.rb +107 -0
- data/examples/ogl-3_2-basic.rb +128 -0
- data/examples/ogl-3_2-cube.rb +203 -0
- data/examples/ogl-4_0-quad_tessellation.rb +283 -0
- data/examples/ogl-4_0-triangle_tessellation.rb +262 -0
- data/lib/glut.rb +125 -0
- data/lib/opengl.rb +7 -0
- data/lib/opengl/constants.rb +15 -0
- data/lib/opengl/constants/core/2_x/GL_VERSION_1_1.yml +230 -0
- data/lib/opengl/constants/core/2_x/GL_VERSION_1_2.yml +36 -0
- data/lib/opengl/constants/core/2_x/GL_VERSION_1_3.yml +59 -0
- data/lib/opengl/constants/core/2_x/GL_VERSION_1_4.yml +16 -0
- data/lib/opengl/constants/core/2_x/GL_VERSION_1_5.yml +28 -0
- data/lib/opengl/constants/core/2_x/GL_VERSION_2_0.yml +80 -0
- data/lib/opengl/constants/core/2_x/GL_VERSION_2_1.yml +16 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_depth_buffer_float.yml +3 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_framebuffer_object.yml +77 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_framebuffer_sRGB.yml +1 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_half_float_vertex.yml +1 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_map_buffer_range.yml +6 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_texture_compression_rgtc.yml +4 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_texture_rg.yml +22 -0
- data/lib/opengl/constants/core/3_0/GL_ARB_vertex_array_object.yml +1 -0
- data/lib/opengl/constants/core/3_0/GL_VERSION_3_0.yml +224 -0
- data/lib/opengl/constants/core/3_1/GL_ARB_copy_buffer.yml +4 -0
- data/lib/opengl/constants/core/3_1/GL_ARB_uniform_buffer_object.yml +33 -0
- data/lib/opengl/constants/core/3_1/GL_VERSION_3_1.yml +65 -0
- data/lib/opengl/constants/core/3_2/GL_ARB_depth_clamp.yml +1 -0
- data/lib/opengl/constants/core/3_2/GL_ARB_provoking_vertex.yml +4 -0
- data/lib/opengl/constants/core/3_2/GL_ARB_seamless_cube_map.yml +1 -0
- data/lib/opengl/constants/core/3_2/GL_ARB_sync.yml +15 -0
- data/lib/opengl/constants/core/3_2/GL_ARB_texture_multisample.yml +21 -0
- data/lib/opengl/constants/core/3_2/GL_VERSION_3_2.yml +76 -0
- data/lib/opengl/constants/core/3_3/GL_ARB_blend_func_extended.yml +5 -0
- data/lib/opengl/constants/core/3_3/GL_ARB_occlusion_query2.yml +1 -0
- data/lib/opengl/constants/core/3_3/GL_ARB_sampler_objects.yml +1 -0
- data/lib/opengl/constants/core/3_3/GL_ARB_texture_rgb10_a2ui.yml +1 -0
- data/lib/opengl/constants/core/3_3/GL_ARB_texture_swizzle.yml +5 -0
- data/lib/opengl/constants/core/3_3/GL_ARB_timer_query.yml +2 -0
- data/lib/opengl/constants/core/3_3/GL_ARB_vertex_type_2_10_10_10_rev.yml +2 -0
- data/lib/opengl/constants/core/3_3/GL_VERSION_3_3.yml +25 -0
- data/lib/opengl/constants/core/4_0/GL_ARB_draw_indirect.yml +2 -0
- data/lib/opengl/constants/core/4_0/GL_ARB_gpu_shader5.yml +6 -0
- data/lib/opengl/constants/core/4_0/GL_ARB_gpu_shader_fp64.yml +13 -0
- data/lib/opengl/constants/core/4_0/GL_ARB_shader_subroutine.yml +11 -0
- data/lib/opengl/constants/core/4_0/GL_ARB_tessellation_shader.yml +37 -0
- data/lib/opengl/constants/core/4_0/GL_ARB_transform_feedback2.yml +6 -0
- data/lib/opengl/constants/core/4_0/GL_ARB_transform_feedback3.yml +2 -0
- data/lib/opengl/constants/core/4_0/GL_VERSION_4_0.yml +88 -0
- data/lib/opengl/constants/core/4_1/GL_ARB_ES2_compatibility.yml +16 -0
- data/lib/opengl/constants/core/4_1/GL_ARB_get_program_binary.yml +4 -0
- data/lib/opengl/constants/core/4_1/GL_ARB_separate_shader_objects.yml +9 -0
- data/lib/opengl/constants/core/4_1/GL_ARB_viewport_array.yml +13 -0
- data/lib/opengl/constants/core/4_1/GL_VERSION_4_1.yml +44 -0
- data/lib/opengl/constants/core/4_2/GL_ARB_compressed_texture_pixel_storage.yml +8 -0
- data/lib/opengl/constants/core/4_2/GL_ARB_internalformat_query.yml +1 -0
- data/lib/opengl/constants/core/4_2/GL_ARB_map_buffer_alignment.yml +1 -0
- data/lib/opengl/constants/core/4_2/GL_ARB_shader_atomic_counters.yml +29 -0
- data/lib/opengl/constants/core/4_2/GL_ARB_shader_image_load_store.yml +64 -0
- data/lib/opengl/constants/core/4_2/GL_ARB_texture_storage.yml +1 -0
- data/lib/opengl/constants/core/4_2/GL_VERSION_4_2.yml +116 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_ES3_compatibility.yml +13 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_compute_shader.yml +18 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_explicit_uniform_location.yml +1 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_framebuffer_no_attachments.yml +9 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_internalformat_query2.yml +115 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_program_interface_query.yml +50 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_shader_storage_buffer_object.yml +18 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_stencil_texturing.yml +1 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_texture_buffer_range.yml +3 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_texture_view.yml +5 -0
- data/lib/opengl/constants/core/4_3/GL_ARB_vertex_attrib_binding.yml +7 -0
- data/lib/opengl/constants/core/4_3/GL_KHR_debug.yml +41 -0
- data/lib/opengl/constants/core/4_3/GL_VERSION_4_3.yml +281 -0
- data/lib/opengl/constants/ext/GL_EXT_texture_compression_s3tc.yml +4 -0
- data/lib/opengl/constants/ext/GL_EXT_texture_filter_anisotropic.yml +2 -0
- data/lib/opengl/constants/ext/GL_EXT_texture_sRGB.yml +16 -0
- data/lib/opengl/debugging.rb +38 -0
- data/lib/opengl/gl.rb +26 -0
- data/lib/opengl/platform.rb +4 -0
- data/lib/opengl/platform/base.rb +30 -0
- data/lib/opengl/platform/darwin.rb +24 -0
- data/lib/opengl/platform/linux.rb +25 -0
- data/lib/opengl/platform/types/darwin.yml +2 -0
- data/lib/opengl/platform/types/default.yml +27 -0
- data/lib/opengl/platform/types/linux.yml +2 -0
- data/lib/opengl/raw.rb +44 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_1_0.yml +259 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_1_1.yml +106 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_1_2.yml +60 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_1_3.yml +85 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_1_4.yml +43 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_1_5.yml +103 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_2_0.yml +537 -0
- data/lib/opengl/raw/core/2_x/GL_VERSION_2_1.yml +43 -0
- data/lib/opengl/raw/core/3_0/GL_ARB_framebuffer_object.yml +128 -0
- data/lib/opengl/raw/core/3_0/GL_ARB_map_buffer_range.yml +14 -0
- data/lib/opengl/raw/core/3_0/GL_ARB_vertex_array_object.yml +19 -0
- data/lib/opengl/raw/core/3_0/GL_VERSION_3_0.yml +340 -0
- data/lib/opengl/raw/core/3_1/GL_ARB_copy_buffer.yml +9 -0
- data/lib/opengl/raw/core/3_1/GL_ARB_uniform_buffer_object.yml +50 -0
- data/lib/opengl/raw/core/3_1/GL_VERSION_3_1.yml +26 -0
- data/lib/opengl/raw/core/3_2/GL_ARB_draw_elements_base_vertex.yml +37 -0
- data/lib/opengl/raw/core/3_2/GL_ARB_provoking_vertex.yml +5 -0
- data/lib/opengl/raw/core/3_2/GL_ARB_sync.yml +39 -0
- data/lib/opengl/raw/core/3_2/GL_ARB_texture_multisample.yml +31 -0
- data/lib/opengl/raw/core/3_2/GL_VERSION_3_2.yml +20 -0
- data/lib/opengl/raw/core/3_3/GL_ARB_blend_func_extended.yml +13 -0
- data/lib/opengl/raw/core/3_3/GL_ARB_sampler_objects.yml +80 -0
- data/lib/opengl/raw/core/3_3/GL_ARB_timer_query.yml +18 -0
- data/lib/opengl/raw/core/3_3/GL_ARB_vertex_type_2_10_10_10_rev.yml +57 -0
- data/lib/opengl/raw/core/3_3/GL_VERSION_3_3.yml +6 -0
- data/lib/opengl/raw/core/4_0/GL_ARB_draw_indirect.yml +12 -0
- data/lib/opengl/raw/core/4_0/GL_ARB_gpu_shader_fp64.yml +120 -0
- data/lib/opengl/raw/core/4_0/GL_ARB_shader_subroutine.yml +58 -0
- data/lib/opengl/raw/core/4_0/GL_ARB_tessellation_shader.yml +11 -0
- data/lib/opengl/raw/core/4_0/GL_ARB_transform_feedback2.yml +31 -0
- data/lib/opengl/raw/core/4_0/GL_ARB_transform_feedback3.yml +25 -0
- data/lib/opengl/raw/core/4_0/GL_VERSION_4_0.yml +30 -0
- data/lib/opengl/raw/core/4_1/GL_ARB_ES2_compatibility.yml +28 -0
- data/lib/opengl/raw/core/4_1/GL_ARB_get_program_binary.yml +22 -0
- data/lib/opengl/raw/core/4_1/GL_ARB_separate_shader_objects.yml +429 -0
- data/lib/opengl/raw/core/4_1/GL_ARB_vertex_attrib_64bit.yml +61 -0
- data/lib/opengl/raw/core/4_1/GL_ARB_viewport_array.yml +63 -0
- data/lib/opengl/raw/core/4_1/GL_VERSION_4_1.yml +1 -0
- data/lib/opengl/raw/core/4_2/GL_ARB_base_instance.yml +28 -0
- data/lib/opengl/raw/core/4_2/GL_ARB_internalformat_query.yml +9 -0
- data/lib/opengl/raw/core/4_2/GL_ARB_shader_atomic_counters.yml +8 -0
- data/lib/opengl/raw/core/4_2/GL_ARB_shader_image_load_store.yml +15 -0
- data/lib/opengl/raw/core/4_2/GL_ARB_texture_storage.yml +52 -0
- data/lib/opengl/raw/core/4_2/GL_ARB_transform_feedback_instanced.yml +14 -0
- data/lib/opengl/raw/core/4_2/GL_VERSION_4_2.yml +1 -0
- data/lib/opengl/type.rb +74 -0
- data/lib/opengl/version.rb +3 -0
- data/lib/opengl/wrapper.rb +13 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_1_0.rb +165 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_1_1.rb +29 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_1_2.rb +13 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_1_3.rb +16 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_1_4.rb +18 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_1_5.rb +49 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_2_0.rb +184 -0
- data/lib/opengl/wrapper/core/2_x/GL_VERSION_2_1.rb +13 -0
- data/lib/opengl/wrapper/core/3_0/GL_ARB_framebuffer_object.rb +43 -0
- data/lib/opengl/wrapper/core/3_0/GL_ARB_map_buffer_range.rb +11 -0
- data/lib/opengl/wrapper/core/3_0/GL_ARB_vertex_array_object.rb +16 -0
- data/lib/opengl/wrapper/core/3_0/GL_VERSION_3_0.rb +87 -0
- data/lib/opengl/wrapper/macros/base.rb +80 -0
- data/opengl.gemspec +25 -0
- data/spec/spec_helper.rb +8 -0
- data/test/test_helper.rb +8 -0
- metadata +269 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
---
|
2
|
+
glVertexAttribL1d:
|
3
|
+
return_type: void
|
4
|
+
parameters:
|
5
|
+
- GLuint index
|
6
|
+
- GLdouble x
|
7
|
+
glVertexAttribL2d:
|
8
|
+
return_type: void
|
9
|
+
parameters:
|
10
|
+
- GLuint index
|
11
|
+
- GLdouble x
|
12
|
+
- GLdouble y
|
13
|
+
glVertexAttribL3d:
|
14
|
+
return_type: void
|
15
|
+
parameters:
|
16
|
+
- GLuint index
|
17
|
+
- GLdouble x
|
18
|
+
- GLdouble y
|
19
|
+
- GLdouble z
|
20
|
+
glVertexAttribL4d:
|
21
|
+
return_type: void
|
22
|
+
parameters:
|
23
|
+
- GLuint index
|
24
|
+
- GLdouble x
|
25
|
+
- GLdouble y
|
26
|
+
- GLdouble z
|
27
|
+
- GLdouble w
|
28
|
+
glVertexAttribL1dv:
|
29
|
+
return_type: void
|
30
|
+
parameters:
|
31
|
+
- GLuint index
|
32
|
+
- GLdouble_in v
|
33
|
+
glVertexAttribL2dv:
|
34
|
+
return_type: void
|
35
|
+
parameters:
|
36
|
+
- GLuint index
|
37
|
+
- GLdouble_in v
|
38
|
+
glVertexAttribL3dv:
|
39
|
+
return_type: void
|
40
|
+
parameters:
|
41
|
+
- GLuint index
|
42
|
+
- GLdouble_in v
|
43
|
+
glVertexAttribL4dv:
|
44
|
+
return_type: void
|
45
|
+
parameters:
|
46
|
+
- GLuint index
|
47
|
+
- GLdouble_in v
|
48
|
+
glVertexAttribLPointer:
|
49
|
+
return_type: void
|
50
|
+
parameters:
|
51
|
+
- GLuint index
|
52
|
+
- GLint size
|
53
|
+
- GLenum type
|
54
|
+
- GLsizei stride
|
55
|
+
- buffer_in pointer
|
56
|
+
glGetVertexAttribLdv:
|
57
|
+
return_type: void
|
58
|
+
parameters:
|
59
|
+
- GLuint index
|
60
|
+
- GLenum pname
|
61
|
+
- GLdouble_out params
|
@@ -0,0 +1,63 @@
|
|
1
|
+
---
|
2
|
+
glViewportArrayv:
|
3
|
+
return_type: void
|
4
|
+
parameters:
|
5
|
+
- GLuint first
|
6
|
+
- GLsizei count
|
7
|
+
- GLfloat_in v
|
8
|
+
glViewportIndexedf:
|
9
|
+
return_type: void
|
10
|
+
parameters:
|
11
|
+
- GLuint index
|
12
|
+
- GLfloat x
|
13
|
+
- GLfloat y
|
14
|
+
- GLfloat w
|
15
|
+
- GLfloat h
|
16
|
+
glViewportIndexedfv:
|
17
|
+
return_type: void
|
18
|
+
parameters:
|
19
|
+
- GLuint index
|
20
|
+
- GLfloat_in v
|
21
|
+
glScissorArrayv:
|
22
|
+
return_type: void
|
23
|
+
parameters:
|
24
|
+
- GLuint first
|
25
|
+
- GLsizei count
|
26
|
+
- GLint_in v
|
27
|
+
glScissorIndexed:
|
28
|
+
return_type: void
|
29
|
+
parameters:
|
30
|
+
- GLuint index
|
31
|
+
- GLint left
|
32
|
+
- GLint bottom
|
33
|
+
- GLsizei width
|
34
|
+
- GLsizei height
|
35
|
+
glScissorIndexedv:
|
36
|
+
return_type: void
|
37
|
+
parameters:
|
38
|
+
- GLuint index
|
39
|
+
- GLint_in v
|
40
|
+
glDepthRangeArrayv:
|
41
|
+
return_type: void
|
42
|
+
parameters:
|
43
|
+
- GLuint first
|
44
|
+
- GLsizei count
|
45
|
+
- GLdouble_in v
|
46
|
+
glDepthRangeIndexed:
|
47
|
+
return_type: void
|
48
|
+
parameters:
|
49
|
+
- GLuint index
|
50
|
+
- GLdouble n
|
51
|
+
- GLdouble f
|
52
|
+
glGetFloati_v:
|
53
|
+
return_type: void
|
54
|
+
parameters:
|
55
|
+
- GLenum target
|
56
|
+
- GLuint index
|
57
|
+
- GLfloat_out data
|
58
|
+
glGetDoublei_v:
|
59
|
+
return_type: void
|
60
|
+
parameters:
|
61
|
+
- GLenum target
|
62
|
+
- GLuint index
|
63
|
+
- GLdouble_out data
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
glDrawArraysInstancedBaseInstance:
|
3
|
+
return_type: void
|
4
|
+
parameters:
|
5
|
+
- GLenum mode
|
6
|
+
- GLint first
|
7
|
+
- GLsizei count
|
8
|
+
- GLsizei instancecount
|
9
|
+
- GLuint baseinstance
|
10
|
+
glDrawElementsInstancedBaseInstance:
|
11
|
+
return_type: void
|
12
|
+
parameters:
|
13
|
+
- GLenum mode
|
14
|
+
- GLsizei count
|
15
|
+
- GLenum type
|
16
|
+
- buffer_in indices
|
17
|
+
- GLsizei instancecount
|
18
|
+
- GLuint baseinstance
|
19
|
+
glDrawElementsInstancedBaseVertexBaseInstance:
|
20
|
+
return_type: void
|
21
|
+
parameters:
|
22
|
+
- GLenum mode
|
23
|
+
- GLsizei count
|
24
|
+
- GLenum type
|
25
|
+
- buffer_in indices
|
26
|
+
- GLsizei instancecount
|
27
|
+
- GLint basevertex
|
28
|
+
- GLuint baseinstance
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
glBindImageTexture:
|
3
|
+
return_type: void
|
4
|
+
parameters:
|
5
|
+
- GLuint unit
|
6
|
+
- GLuint texture
|
7
|
+
- GLint level
|
8
|
+
- GLboolean layered
|
9
|
+
- GLint layer
|
10
|
+
- GLenum access
|
11
|
+
- GLenum format
|
12
|
+
glMemoryBarrier:
|
13
|
+
return_type: void
|
14
|
+
parameters:
|
15
|
+
- GLbitfield barriers
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
glTexStorage1D:
|
3
|
+
return_type: void
|
4
|
+
parameters:
|
5
|
+
- GLenum target
|
6
|
+
- GLsizei levels
|
7
|
+
- GLenum internalformat
|
8
|
+
- GLsizei width
|
9
|
+
glTexStorage2D:
|
10
|
+
return_type: void
|
11
|
+
parameters:
|
12
|
+
- GLenum target
|
13
|
+
- GLsizei levels
|
14
|
+
- GLenum internalformat
|
15
|
+
- GLsizei width
|
16
|
+
- GLsizei height
|
17
|
+
glTexStorage3D:
|
18
|
+
return_type: void
|
19
|
+
parameters:
|
20
|
+
- GLenum target
|
21
|
+
- GLsizei levels
|
22
|
+
- GLenum internalformat
|
23
|
+
- GLsizei width
|
24
|
+
- GLsizei height
|
25
|
+
- GLsizei depth
|
26
|
+
glTextureStorage1DEXT:
|
27
|
+
return_type: void
|
28
|
+
parameters:
|
29
|
+
- GLuint texture
|
30
|
+
- GLenum target
|
31
|
+
- GLsizei levels
|
32
|
+
- GLenum internalformat
|
33
|
+
- GLsizei width
|
34
|
+
glTextureStorage2DEXT:
|
35
|
+
return_type: void
|
36
|
+
parameters:
|
37
|
+
- GLuint texture
|
38
|
+
- GLenum target
|
39
|
+
- GLsizei levels
|
40
|
+
- GLenum internalformat
|
41
|
+
- GLsizei width
|
42
|
+
- GLsizei height
|
43
|
+
glTextureStorage3DEXT:
|
44
|
+
return_type: void
|
45
|
+
parameters:
|
46
|
+
- GLuint texture
|
47
|
+
- GLenum target
|
48
|
+
- GLsizei levels
|
49
|
+
- GLenum internalformat
|
50
|
+
- GLsizei width
|
51
|
+
- GLsizei height
|
52
|
+
- GLsizei depth
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
glDrawTransformFeedbackInstanced:
|
3
|
+
return_type: void
|
4
|
+
parameters:
|
5
|
+
- GLenum mode
|
6
|
+
- GLuint id
|
7
|
+
- GLsizei instancecount
|
8
|
+
glDrawTransformFeedbackStreamInstanced:
|
9
|
+
return_type: void
|
10
|
+
parameters:
|
11
|
+
- GLenum mode
|
12
|
+
- GLuint id
|
13
|
+
- GLuint stream
|
14
|
+
- GLsizei instancecount
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
data/lib/opengl/type.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
require_relative 'platform'
|
3
|
+
|
4
|
+
module OpenGL
|
5
|
+
module Type
|
6
|
+
|
7
|
+
@primitive_types = Platform.current.primitive_types.dup
|
8
|
+
#@regex_buffer_in_types = /\A(#{@primitive_types.keys.join('|')})_in\z/
|
9
|
+
#@regex_buffer_out_types = /\A(#{@primitive_types.keys.join('|')})_out\z/
|
10
|
+
|
11
|
+
@type_map = Hash[
|
12
|
+
@primitive_types.to_a +
|
13
|
+
@primitive_types.keys.map {|t| [:"#{t}_in", :buffer_in] } +
|
14
|
+
@primitive_types.keys.map {|t| [:"#{t}_out", :buffer_out] } +
|
15
|
+
[ [:pointer_out, :buffer_out], [:pointer_in, :buffer_in] ] +
|
16
|
+
[ [:GLchar_pointer_in, :buffer_in] ]
|
17
|
+
]
|
18
|
+
|
19
|
+
def self.find(type)
|
20
|
+
type = type.to_sym
|
21
|
+
type = @type_map.fetch(type, type)
|
22
|
+
if RUBY_ENGINE == "rbx" # work around for Rubinius
|
23
|
+
[:buffer_in, :buffer_out].include?(type) ? :pointer : type
|
24
|
+
else
|
25
|
+
type
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
MemoryPointerInstanceMethods = Module.new
|
30
|
+
@primitive_types.each do |gl_type, old_type|
|
31
|
+
code = <<-RUBY
|
32
|
+
def read_array_of_#{gl_type}(n)
|
33
|
+
read_array_of_#{old_type}(n)
|
34
|
+
end
|
35
|
+
def get_array_of_#{gl_type}(off, n)
|
36
|
+
get_array_of_#{old_type}(off, n)
|
37
|
+
end
|
38
|
+
def write_array_of_#{gl_type}(ary)
|
39
|
+
write_array_of_#{old_type}(ary)
|
40
|
+
end
|
41
|
+
def put_array_of_#{gl_type}(off, ary)
|
42
|
+
put_array_of_#{old_type}(off, ary)
|
43
|
+
end
|
44
|
+
RUBY
|
45
|
+
MemoryPointerInstanceMethods.module_eval code, __FILE__, __LINE__
|
46
|
+
end
|
47
|
+
|
48
|
+
@primitive_types.each do |gl_type, old_type|
|
49
|
+
code = <<-RUBY
|
50
|
+
def self.#{gl_type}(n)
|
51
|
+
ptr = pointer(FFI::MemoryPointer.new(:#{old_type}, n))
|
52
|
+
if block_given?
|
53
|
+
yield ptr
|
54
|
+
else
|
55
|
+
return ptr
|
56
|
+
end
|
57
|
+
end
|
58
|
+
RUBY
|
59
|
+
self.module_eval code, __FILE__, __LINE__
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.pointer(ptr = nil)
|
63
|
+
if ptr.is_a? Integer
|
64
|
+
ptr = FFI::MemoryPointer(:pointer, n)
|
65
|
+
end
|
66
|
+
ptr.extend MemoryPointerInstanceMethods
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.to_boolean(bool)
|
70
|
+
(bool && bool != 0) ? Constants::GL_TRUE : Constants::GL_FALSE
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'raw'
|
2
|
+
|
3
|
+
module OpenGL::Wrapper
|
4
|
+
ROOT = File.expand_path('../wrapper', __FILE__)
|
5
|
+
end
|
6
|
+
|
7
|
+
Dir[File.join(OpenGL::Wrapper::ROOT, 'macros', '**', '*.rb')].each do |path|
|
8
|
+
require path
|
9
|
+
end
|
10
|
+
|
11
|
+
Dir[File.join(OpenGL::Wrapper::ROOT, "**", "GL_*.rb")].each do |path|
|
12
|
+
require path
|
13
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
module OpenGL
|
2
|
+
module Wrapper::GL_VERSION_1_0
|
3
|
+
extend Wrapper::Base
|
4
|
+
|
5
|
+
# glCullFace
|
6
|
+
#
|
7
|
+
# @method glCullFace
|
8
|
+
# @param [Integer] mode
|
9
|
+
def_wrapped('CullFace')
|
10
|
+
|
11
|
+
# glFrontFace
|
12
|
+
#
|
13
|
+
# @method glFrontFace
|
14
|
+
# @param [Integer] mode
|
15
|
+
def_wrapped('FrontFace')
|
16
|
+
|
17
|
+
# glHint
|
18
|
+
#
|
19
|
+
# @method glHint
|
20
|
+
# @param [Integer] target
|
21
|
+
# @param [Integer] mode
|
22
|
+
def_wrapped('Hint')
|
23
|
+
|
24
|
+
# glLineWidth
|
25
|
+
#
|
26
|
+
# @method glLineWidth
|
27
|
+
# @param [Float] width
|
28
|
+
def_wrapped('LineWidth')
|
29
|
+
|
30
|
+
# glPointSize
|
31
|
+
#
|
32
|
+
# @method glPointSize
|
33
|
+
# @param [Float] size
|
34
|
+
def_wrapped('PointSize')
|
35
|
+
|
36
|
+
# glPolygonMode
|
37
|
+
#
|
38
|
+
# @method glPolygonMode
|
39
|
+
# @param [Integer] face
|
40
|
+
# @param [Integer] mode
|
41
|
+
def_wrapped('PolygonMode')
|
42
|
+
|
43
|
+
# glScissor
|
44
|
+
#
|
45
|
+
# @method glScissor
|
46
|
+
# @param [Integer] x
|
47
|
+
# @param [Integer] y
|
48
|
+
# @param [Integer] width
|
49
|
+
# @param [Integer] height
|
50
|
+
def_wrapped('Scissor')
|
51
|
+
|
52
|
+
# glTexParameterf
|
53
|
+
#
|
54
|
+
# @method glTexParameterf
|
55
|
+
# @param [Integer] target
|
56
|
+
# @param [Integer] pname
|
57
|
+
# @param [Float] param
|
58
|
+
def_wrapped('TexParameterf')
|
59
|
+
|
60
|
+
# glTexParameterfv
|
61
|
+
#
|
62
|
+
# @method glTexParameterfv
|
63
|
+
# @param [Integer] target
|
64
|
+
# @param [Integer] pname
|
65
|
+
# @param [Array of Float] params
|
66
|
+
def_glSetValues('TexParameterf', :GLfloat, %w(target pname))
|
67
|
+
|
68
|
+
# glTexParameteri
|
69
|
+
#
|
70
|
+
# @method glTexParameteri
|
71
|
+
# @param [Integer] target
|
72
|
+
# @param [Integer] pname
|
73
|
+
# @param [Integer] param
|
74
|
+
def_wrapped('TexParameteri')
|
75
|
+
|
76
|
+
# glTexParameteriv
|
77
|
+
#
|
78
|
+
# @method glTexParameteriv
|
79
|
+
# @param [Integer] target
|
80
|
+
# @param [Integer] pname
|
81
|
+
# @param [Array of Integer] params
|
82
|
+
def_glSetValues('TexParameteri', :GLint, %w(target pname))
|
83
|
+
|
84
|
+
# glTexImage1D
|
85
|
+
# glTexImage2D
|
86
|
+
# glDrawBuffer
|
87
|
+
# glClear
|
88
|
+
# glClearColor
|
89
|
+
# glClearStencil
|
90
|
+
# glClearDepth
|
91
|
+
# glStencilMask
|
92
|
+
# glColorMask
|
93
|
+
# glDepthMask
|
94
|
+
# glDisable
|
95
|
+
# glEnable
|
96
|
+
# glFinish
|
97
|
+
# glFlush
|
98
|
+
# glBlendFunc
|
99
|
+
# glLogicOp
|
100
|
+
# glStencilFunc
|
101
|
+
# glStencilOp
|
102
|
+
# glDepthFunc
|
103
|
+
# glPixelStoref
|
104
|
+
# glPixelStorei
|
105
|
+
# glReadBuffer
|
106
|
+
# glReadPixels
|
107
|
+
|
108
|
+
# glGetBooleanv
|
109
|
+
def_glGetValues('Boolean', :GLboolean, %w(pname))
|
110
|
+
|
111
|
+
# glGetDoublev
|
112
|
+
def_glGetValues('Double', :GLdouble, %w(pname))
|
113
|
+
|
114
|
+
# glGetError
|
115
|
+
|
116
|
+
# glGetFloatv
|
117
|
+
def_glGetValues('Float', :GLfloat, %w(pname))
|
118
|
+
|
119
|
+
# glGetIntegerv
|
120
|
+
def_glGetValues('Integer', :GLint, %w(pname))
|
121
|
+
|
122
|
+
# glGetString
|
123
|
+
# usage: glGetString() -> String
|
124
|
+
|
125
|
+
# glGetTexImage
|
126
|
+
|
127
|
+
# glGetTexParameterfv
|
128
|
+
def_glGetValues('TexParameterf', :GLfloat, %w(target pname))
|
129
|
+
|
130
|
+
# glGetTexParameteriv
|
131
|
+
def_glGetValues('TexParameteri', :GLint, %w(target pname))
|
132
|
+
|
133
|
+
# glGetTexLevelParameterfv
|
134
|
+
def_glGetValues('TexLevelParameterf', :GLfloat, %w(target level pname))
|
135
|
+
|
136
|
+
# glGetTexLevelParameteriv
|
137
|
+
def_glGetValues('TexLevelParameteri', :GLint, %w(target level pname))
|
138
|
+
|
139
|
+
# glIsEnabled
|
140
|
+
# glDepthRange
|
141
|
+
# glViewport
|
142
|
+
|
143
|
+
#
|
144
|
+
def glGetVersion(target = Constants::GL_VERSION)
|
145
|
+
mdata = %r{\A(\d+)\.(\d+)}.match(glGetString(target))
|
146
|
+
return [mdata[1].to_i, mdata[2].to_i]
|
147
|
+
end
|
148
|
+
|
149
|
+
#
|
150
|
+
def glGetShadingLanguageVersion()
|
151
|
+
glGetVersion(Constants::GL_SHADING_LANGUAGE_VERSION)
|
152
|
+
end
|
153
|
+
|
154
|
+
#
|
155
|
+
def glGetAvailableExtensions()
|
156
|
+
if glGetVersion().first >= 3
|
157
|
+
n = glGetIntegerv(Constants::GL_NUM_EXTENSIONS)[0]
|
158
|
+
return (0...n).map{|i| glGetStringi(Constants::GL_EXTENSIONS, i) }
|
159
|
+
else
|
160
|
+
glGetString(Constants::GL_EXTENSIONS).split()
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|