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,262 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'opengl'
|
4
|
+
require 'glut'
|
5
|
+
require_relative 'math3d'
|
6
|
+
|
7
|
+
class TestApp
|
8
|
+
include GLUT
|
9
|
+
include OpenGL::Constants
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
caps = GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE
|
13
|
+
if FFI::Platform.mac?
|
14
|
+
caps |= GLUT_4_0_CORE_PROFILE
|
15
|
+
else
|
16
|
+
glutInitContextVersion(4, 0)
|
17
|
+
glutInitContextProfile(:core)
|
18
|
+
end
|
19
|
+
glutInitDisplayMode(caps)
|
20
|
+
glutInitWindowPosition(300, 200)
|
21
|
+
glutInitWindowSize(512, 512)
|
22
|
+
glutCreateWindow('tessellation')
|
23
|
+
|
24
|
+
glutDisplayFunc(@draw_method ||= method(:draw))
|
25
|
+
glutReshapeFunc(@resize_method ||= method(:resize))
|
26
|
+
glutMouseFunc(@mouse_press_method ||= method(:mouse_press))
|
27
|
+
glutMotionFunc(@mouse_track_method ||= method(:mouse_track))
|
28
|
+
end
|
29
|
+
|
30
|
+
def start
|
31
|
+
self.extend OpenGL::GL.entrypoints
|
32
|
+
puts glGetString(GL_VERSION)
|
33
|
+
|
34
|
+
@triangle = begin
|
35
|
+
vertex_buffer = glGenBuffers(1)[0]
|
36
|
+
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer)
|
37
|
+
glBufferData(GL_ARRAY_BUFFER, 4*2*3, nil, GL_STATIC_DRAW)
|
38
|
+
glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY) do |ptr|
|
39
|
+
r = 1.0
|
40
|
+
s = Math.sqrt(0.75) * r
|
41
|
+
ptr.put_array_of_GLfloat(0, [0.0, r])
|
42
|
+
ptr.put_array_of_GLfloat(8, [s, -0.5*r])
|
43
|
+
ptr.put_array_of_GLfloat(16, [-s, -0.5*r])
|
44
|
+
end
|
45
|
+
|
46
|
+
array = glGenVertexArrays(1)[0]
|
47
|
+
glBindVertexArray(array)
|
48
|
+
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer)
|
49
|
+
glEnableVertexAttribArray(0)
|
50
|
+
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, nil)
|
51
|
+
|
52
|
+
glBindVertexArray(0)
|
53
|
+
glBindBuffer(GL_ARRAY_BUFFER, 0)
|
54
|
+
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)
|
55
|
+
|
56
|
+
array
|
57
|
+
end
|
58
|
+
|
59
|
+
@program = begin
|
60
|
+
vertex_shader = glCreateShader(:vertex)
|
61
|
+
glShaderSource(vertex_shader, VS_CODE)
|
62
|
+
glCompileShader(vertex_shader)
|
63
|
+
unless glIsShaderCompiled?(vertex_shader)
|
64
|
+
msg = glGetShaderInfoLog(vertex_shader)
|
65
|
+
raise RuntimeError, "vertex_shader:\n#{msg}"
|
66
|
+
end
|
67
|
+
|
68
|
+
tess_control_shader = glCreateShader(:tess_control)
|
69
|
+
glShaderSource(tess_control_shader, TC_CODE)
|
70
|
+
glCompileShader(tess_control_shader)
|
71
|
+
unless glIsShaderCompiled?(tess_control_shader)
|
72
|
+
msg = glGetShaderInfoLog(tess_control_shader)
|
73
|
+
raise RuntimeError, "tess_control_shader:\n#{msg}"
|
74
|
+
end
|
75
|
+
|
76
|
+
tess_eval_shader = glCreateShader(:tess_eval)
|
77
|
+
glShaderSource(tess_eval_shader, TE_CODE)
|
78
|
+
glCompileShader(tess_eval_shader)
|
79
|
+
unless glIsShaderCompiled?(tess_eval_shader)
|
80
|
+
msg = glGetShaderInfoLog(tess_eval_shader)
|
81
|
+
raise RuntimeError, "tess_eval_shader:\n#{msg}"
|
82
|
+
end
|
83
|
+
|
84
|
+
geometry_shader = glCreateShader(:geometry)
|
85
|
+
glShaderSource(geometry_shader, GS_CODE)
|
86
|
+
glCompileShader(geometry_shader)
|
87
|
+
unless glIsShaderCompiled?(geometry_shader)
|
88
|
+
msg = glGetShaderInfoLog(geometry_shader)
|
89
|
+
raise RuntimeError, "geometry_shader:\n#{msg}"
|
90
|
+
end
|
91
|
+
|
92
|
+
fragment_shader = glCreateShader(:fragment)
|
93
|
+
glShaderSource(fragment_shader, FS_CODE)
|
94
|
+
glCompileShader(fragment_shader)
|
95
|
+
unless glIsShaderCompiled?(fragment_shader)
|
96
|
+
msg = glGetShaderInfoLog(fragment_shader)
|
97
|
+
raise RuntimeError, "fragment_shader:\n#{msg}"
|
98
|
+
end
|
99
|
+
|
100
|
+
program = glCreateProgram()
|
101
|
+
glAttachShader(program, vertex_shader)
|
102
|
+
glAttachShader(program, tess_control_shader)
|
103
|
+
glAttachShader(program, tess_eval_shader)
|
104
|
+
glAttachShader(program, geometry_shader)
|
105
|
+
glAttachShader(program, fragment_shader)
|
106
|
+
glLinkProgram(program)
|
107
|
+
unless glIsProgramLinked?(program)
|
108
|
+
msg = glGetProgramInfoLog(program)
|
109
|
+
raise RuntimeError, "program:\n#{msg}"
|
110
|
+
end
|
111
|
+
glDeleteShader(vertex_shader)
|
112
|
+
glDeleteShader(tess_control_shader)
|
113
|
+
glDeleteShader(tess_eval_shader)
|
114
|
+
glDeleteShader(geometry_shader)
|
115
|
+
glDeleteShader(fragment_shader)
|
116
|
+
program
|
117
|
+
end
|
118
|
+
|
119
|
+
@view = Matrix.translate(0, 0, -5)
|
120
|
+
@world = Matrix.scale(5, 5, 5)
|
121
|
+
|
122
|
+
glutMainLoop()
|
123
|
+
end
|
124
|
+
|
125
|
+
def draw
|
126
|
+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
127
|
+
|
128
|
+
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
|
129
|
+
|
130
|
+
glUseProgram(@program)
|
131
|
+
if (loc = glGetUniformLocation(@program, "u_Projection")) != -1
|
132
|
+
OpenGL::Type.GLfloat(16) do |ptr|
|
133
|
+
ptr.write_array_of_GLfloat(@projection.to_a.flatten)
|
134
|
+
glUniformMatrix4fv(loc, 1, GL_TRUE, ptr)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
if (loc = glGetUniformLocation(@program, "u_ModelView")) != -1
|
138
|
+
OpenGL::Type.GLfloat(16) do |ptr|
|
139
|
+
modelview = @view * @world
|
140
|
+
ptr.write_array_of_GLfloat(modelview.to_a.flatten)
|
141
|
+
glUniformMatrix4fv(loc, 1, GL_TRUE, ptr)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
glPatchParameteri(GL_PATCH_VERTICES, 3)
|
145
|
+
|
146
|
+
glBindVertexArray(@triangle)
|
147
|
+
glDrawArrays(GL_PATCHES, 0, 3)
|
148
|
+
|
149
|
+
glutSwapBuffers()
|
150
|
+
end
|
151
|
+
|
152
|
+
def resize(width, height)
|
153
|
+
glViewport(0, 0, width, height)
|
154
|
+
|
155
|
+
fovy = 45.0 / 180.0 * Math::PI
|
156
|
+
aspect = Float(width) / Float(height)
|
157
|
+
z_near, z_far = 1.0, 100.0
|
158
|
+
@projection = Matrix.perspective(fovy, aspect, z_near, z_far)
|
159
|
+
end
|
160
|
+
|
161
|
+
def mouse_press(button, button_state, x, y)
|
162
|
+
if button == :LEFT
|
163
|
+
case button_state
|
164
|
+
when :DOWN
|
165
|
+
@mouse_tracking_pos = [x, y]
|
166
|
+
when :UP
|
167
|
+
remove_instance_variable(:@mouse_tracking_pos)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def mouse_track(x, y)
|
173
|
+
if defined? @mouse_tracking_pos
|
174
|
+
delta_x = (x - @mouse_tracking_pos[0]) * 0.01
|
175
|
+
delta_y = (y - @mouse_tracking_pos[1]) * 0.01
|
176
|
+
|
177
|
+
#@world = Matrix.rotate_x(delta_y) * Matrix.rotate_y(delta_x) * @world
|
178
|
+
@world = Matrix.translate(0,0,delta_y) * @world
|
179
|
+
|
180
|
+
@mouse_tracking_pos = [x, y]
|
181
|
+
glutPostRedisplay()
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
VS_CODE =<<-GLSL
|
186
|
+
#version 400 core
|
187
|
+
uniform mat4 u_Projection;
|
188
|
+
uniform mat4 u_ModelView;
|
189
|
+
layout(location = 0) in vec4 in_Position;
|
190
|
+
//out vec3 vs_Position;
|
191
|
+
//out vec2 vs_TexCoord;
|
192
|
+
void main()
|
193
|
+
{
|
194
|
+
gl_Position = u_Projection * u_ModelView * in_Position;
|
195
|
+
//vs_Position = in_Position.xyz;
|
196
|
+
//vs_TexCoord = in_Position.xy + 0.5;
|
197
|
+
}
|
198
|
+
GLSL
|
199
|
+
|
200
|
+
TC_CODE =<<-GLSL
|
201
|
+
#version 400 core
|
202
|
+
layout(vertices=3) out;
|
203
|
+
#define ID gl_InvocationID
|
204
|
+
void main()
|
205
|
+
{
|
206
|
+
gl_out[ID].gl_Position = gl_in[ID].gl_Position;
|
207
|
+
if (ID == 0) {
|
208
|
+
float sum = 0.0;
|
209
|
+
for (int i = 0; i < 3; ++i) {
|
210
|
+
vec4 v = gl_in[i].gl_Position;
|
211
|
+
sum += v.z / v.w;
|
212
|
+
}
|
213
|
+
sum /= 3;
|
214
|
+
float k = 40 * clamp(1.0 - sum, 0.0, 2.0);
|
215
|
+
gl_TessLevelInner[0] = k;
|
216
|
+
gl_TessLevelOuter[0] = k;
|
217
|
+
gl_TessLevelOuter[1] = k;
|
218
|
+
gl_TessLevelOuter[2] = k;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
GLSL
|
222
|
+
|
223
|
+
TE_CODE =<<-GLSL
|
224
|
+
#version 400 core
|
225
|
+
layout(triangles, fractional_even_spacing, ccw) in;
|
226
|
+
void main()
|
227
|
+
{
|
228
|
+
vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position;
|
229
|
+
vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position;
|
230
|
+
vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position;
|
231
|
+
gl_Position = p0 + p1 + p2;
|
232
|
+
}
|
233
|
+
GLSL
|
234
|
+
|
235
|
+
GS_CODE =<<-GLSL
|
236
|
+
#version 400 core
|
237
|
+
layout(triangles) in;
|
238
|
+
layout(triangle_strip, max_vertices=3) out;
|
239
|
+
void main()
|
240
|
+
{
|
241
|
+
for (int i = 0; i < 3; ++i) {
|
242
|
+
gl_Position = gl_in[i].gl_Position;
|
243
|
+
EmitVertex();
|
244
|
+
}
|
245
|
+
EndPrimitive();
|
246
|
+
}
|
247
|
+
GLSL
|
248
|
+
|
249
|
+
FS_CODE =<<-GLSL
|
250
|
+
#version 400 core
|
251
|
+
//in vec2 vs_TexCoord;
|
252
|
+
layout(location = 0) out vec4 fs_FragColor;
|
253
|
+
void main()
|
254
|
+
{
|
255
|
+
//fs_FragColor = vec4(vs_TexCoord, 0.0, 1.0);
|
256
|
+
fs_FragColor = vec4(1.0);
|
257
|
+
}
|
258
|
+
GLSL
|
259
|
+
|
260
|
+
end
|
261
|
+
|
262
|
+
TestApp.new.start
|
data/lib/glut.rb
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
3
|
+
module GLUT
|
4
|
+
extend FFI::Library
|
5
|
+
|
6
|
+
case FFI::Platform::OS
|
7
|
+
when "darwin"
|
8
|
+
ffi_lib "/System/Library/Frameworks/GLUT.framework/GLUT"
|
9
|
+
when "linux"
|
10
|
+
ffi_lib "libglut.so.3"
|
11
|
+
else raise RuntimeError, "GLUT: Unsupported OS"
|
12
|
+
end
|
13
|
+
|
14
|
+
# keyboard / mouse callback constants
|
15
|
+
typedef :uchar, :key
|
16
|
+
enum :special_key, [:F1, 0x1] + (2..12).map{|n| :"F#{n}" } +
|
17
|
+
[:LEFT, 0x64, :UP, :RIGHT, :DOWN, :PAGE_UP, :PAGE_DOWN,
|
18
|
+
:HOME, :END, :INSERT]
|
19
|
+
|
20
|
+
enum :mouse_button, [:LEFT, 0x0, :MIDDLE, :RIGHT]
|
21
|
+
enum :mouse_button_state, [:DOWN, 0x0, :UP]
|
22
|
+
enum :mouse_entry_state, [:LEFT, 0x0, :ENTERED]
|
23
|
+
|
24
|
+
# display mode bit masks
|
25
|
+
GLUT_RGB = 0x0000
|
26
|
+
GLUT_RGBA = 0x0000
|
27
|
+
GLUT_INDEX = 0x0001
|
28
|
+
GLUT_SINGLE = 0x0000
|
29
|
+
GLUT_DOUBLE = 0x0002
|
30
|
+
GLUT_ACCUM = 0x0004
|
31
|
+
GLUT_ALPHA = 0x0008
|
32
|
+
GLUT_DEPTH = 0x0010
|
33
|
+
GLUT_STENCIL = 0x0020
|
34
|
+
GLUT_MULTISAMPLE = 0x0080
|
35
|
+
GLUT_STEREO = 0x0100
|
36
|
+
GLUT_3_2_CORE_PROFILE = 0x0800 # only for OS X 10.7 and later
|
37
|
+
|
38
|
+
# Init GLUT
|
39
|
+
attach_function :glutInit, [:pointer, :pointer], :void
|
40
|
+
|
41
|
+
# Enter MainLoop (never return)
|
42
|
+
attach_function :glutMainLoop, [], :void
|
43
|
+
|
44
|
+
# Display Buffer
|
45
|
+
attach_function :glutSwapBuffers, [], :void
|
46
|
+
|
47
|
+
# Window
|
48
|
+
typedef :int, :window
|
49
|
+
attach_function :glutInitDisplayMode, [:uint], :void
|
50
|
+
attach_function :glutInitDisplayString, [:string], :void
|
51
|
+
attach_function :glutInitWindowPosition, [:int, :int], :void
|
52
|
+
attach_function :glutInitWindowSize, [:int, :int], :void
|
53
|
+
attach_function :glutCreateWindow, [:string], :window
|
54
|
+
attach_function :glutDestroyWindow, [:window], :void
|
55
|
+
attach_function :glutSetWindow, [:window], :void
|
56
|
+
attach_function :glutGetWindow, [], :window
|
57
|
+
attach_function :glutSetWindowTitle, [:string], :void
|
58
|
+
attach_function :glutReshapeWindow, [ :int, :int ], :void
|
59
|
+
attach_function :glutPositionWindow, [ :int, :int ], :void
|
60
|
+
attach_function :glutShowWindow, [], :void
|
61
|
+
attach_function :glutHideWindow, [], :void
|
62
|
+
|
63
|
+
# Post Redisplay Event
|
64
|
+
attach_function :glutPostWindowRedisplay, [:window], :void
|
65
|
+
attach_function :glutPostRedisplay, [], :void
|
66
|
+
|
67
|
+
# Window Callbacks
|
68
|
+
callback :display_proc, [], :void
|
69
|
+
callback :mouse_proc, [:mouse_button, :mouse_button_state, :int, :int], :void
|
70
|
+
callback :motion_proc, [:int, :int], :void
|
71
|
+
callback :resize_proc, [:int, :int], :void
|
72
|
+
callback :keyboard_proc, [:key, :int, :int], :void
|
73
|
+
callback :special_proc, [:special_key, :int, :int], :void
|
74
|
+
callback :timer_proc, [:int], :void
|
75
|
+
callback :idle_proc, [], :void
|
76
|
+
callback :entry_proc, [:mouse_entry_state], :void
|
77
|
+
attach_function :glutDisplayFunc, [:display_proc], :void
|
78
|
+
attach_function :glutMouseFunc, [:mouse_proc], :void
|
79
|
+
attach_function :glutMotionFunc, [:motion_proc], :void
|
80
|
+
attach_function :glutPassiveMotionFunc, [:motion_proc], :void
|
81
|
+
attach_function :glutReshapeFunc, [:resize_proc], :void
|
82
|
+
attach_function :glutKeyboardFunc, [:keyboard_proc], :void
|
83
|
+
attach_function :glutSpecialFunc, [:special_proc], :void
|
84
|
+
attach_function :glutTimerFunc, [:uint, :timer_proc, :int], :void
|
85
|
+
attach_function :glutIdleFunc, [:idle_proc], :void
|
86
|
+
attach_function :glutEntryFunc, [:entry_proc], :void
|
87
|
+
attach_function :glutKeyboardUpFunc, [:keyboard_proc], :void
|
88
|
+
attach_function :glutSpecialUpFunc, [:special_proc], :void
|
89
|
+
|
90
|
+
# glutGet parameter names
|
91
|
+
enum :glut_pname, [:WINDOW_X, 0x64, :WINDOW_Y, :WINDOW_WIDTH, :WINDOW_HEIGHT,
|
92
|
+
:ELAPSED_TIME, 0x02BC]
|
93
|
+
|
94
|
+
# Misc
|
95
|
+
attach_function :glutGet, [:glut_pname], :int
|
96
|
+
attach_function :raw_glutGetModifiers, :glutGetModifiers, [], :int
|
97
|
+
|
98
|
+
def glutGetModifiers
|
99
|
+
bitfield = raw_glutGetModifiers
|
100
|
+
result = []
|
101
|
+
result << :SHIFT if bitfield & 0x1 != 0
|
102
|
+
result << :CTRL if bitfield & 0x2 != 0
|
103
|
+
result << :ALT if bitfield & 0x4 != 0
|
104
|
+
return result
|
105
|
+
end
|
106
|
+
module_function :glutGetModifiers
|
107
|
+
|
108
|
+
# Init Context
|
109
|
+
unless FFI::Platform.mac?
|
110
|
+
enum :context_profile, [:core, 0x1, :compatibility, 0x2]
|
111
|
+
attach_function :glutInitContextVersion, [:int, :int], :void
|
112
|
+
attach_function :glutInitContextProfile, [:context_profile], :void
|
113
|
+
end
|
114
|
+
|
115
|
+
# Module Initializer
|
116
|
+
def self.init
|
117
|
+
argc = FFI::MemoryPointer.new(:int, 1).write_int(0)
|
118
|
+
argv = FFI::MemoryPointer.new(:pointer, 1)
|
119
|
+
argv.write_pointer(FFI::MemoryPointer::NULL)
|
120
|
+
glutInit(argc, argv)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
GLUT.init
|
data/lib/opengl.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module OpenGL::Constants
|
4
|
+
|
5
|
+
Dir[File.expand_path("../constants/**/GL_*.yml", __FILE__)].each do |path|
|
6
|
+
obj = YAML.load(File.read(path))
|
7
|
+
obj.each do |name, value|
|
8
|
+
unless value.is_a? Integer
|
9
|
+
raise RuntimeError, "#{name} = #{value} must be an integer"
|
10
|
+
end
|
11
|
+
self.const_set(name, value)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,230 @@
|
|
1
|
+
# AttribMask
|
2
|
+
GL_DEPTH_BUFFER_BIT: 0x00000100
|
3
|
+
GL_STENCIL_BUFFER_BIT: 0x00000400
|
4
|
+
GL_COLOR_BUFFER_BIT: 0x00004000
|
5
|
+
# Boolean
|
6
|
+
GL_FALSE: 0
|
7
|
+
GL_TRUE: 1
|
8
|
+
# BeginMode
|
9
|
+
GL_POINTS: 0x0000
|
10
|
+
GL_LINES: 0x0001
|
11
|
+
GL_LINE_LOOP: 0x0002
|
12
|
+
GL_LINE_STRIP: 0x0003
|
13
|
+
GL_TRIANGLES: 0x0004
|
14
|
+
GL_TRIANGLE_STRIP: 0x0005
|
15
|
+
GL_TRIANGLE_FAN: 0x0006
|
16
|
+
GL_QUADS: 0x0007
|
17
|
+
# AlphaFunction
|
18
|
+
GL_NEVER: 0x0200
|
19
|
+
GL_LESS: 0x0201
|
20
|
+
GL_EQUAL: 0x0202
|
21
|
+
GL_LEQUAL: 0x0203
|
22
|
+
GL_GREATER: 0x0204
|
23
|
+
GL_NOTEQUAL: 0x0205
|
24
|
+
GL_GEQUAL: 0x0206
|
25
|
+
GL_ALWAYS: 0x0207
|
26
|
+
# BlendingFactorDest
|
27
|
+
GL_ZERO: 0
|
28
|
+
GL_ONE: 1
|
29
|
+
GL_SRC_COLOR: 0x0300
|
30
|
+
GL_ONE_MINUS_SRC_COLOR: 0x0301
|
31
|
+
GL_SRC_ALPHA: 0x0302
|
32
|
+
GL_ONE_MINUS_SRC_ALPHA: 0x0303
|
33
|
+
GL_DST_ALPHA: 0x0304
|
34
|
+
GL_ONE_MINUS_DST_ALPHA: 0x0305
|
35
|
+
# BlendingFactorSrc
|
36
|
+
GL_DST_COLOR: 0x0306
|
37
|
+
GL_ONE_MINUS_DST_COLOR: 0x0307
|
38
|
+
GL_SRC_ALPHA_SATURATE: 0x0308
|
39
|
+
# DrawBufferMode
|
40
|
+
GL_NONE: 0
|
41
|
+
GL_FRONT_LEFT: 0x0400
|
42
|
+
GL_FRONT_RIGHT: 0x0401
|
43
|
+
GL_BACK_LEFT: 0x0402
|
44
|
+
GL_BACK_RIGHT: 0x0403
|
45
|
+
GL_FRONT: 0x0404
|
46
|
+
GL_BACK: 0x0405
|
47
|
+
GL_LEFT: 0x0406
|
48
|
+
GL_RIGHT: 0x0407
|
49
|
+
GL_FRONT_AND_BACK: 0x0408
|
50
|
+
# ErrorCode
|
51
|
+
GL_NO_ERROR: 0
|
52
|
+
GL_INVALID_ENUM: 0x0500
|
53
|
+
GL_INVALID_VALUE: 0x0501
|
54
|
+
GL_INVALID_OPERATION: 0x0502
|
55
|
+
GL_OUT_OF_MEMORY: 0x0505
|
56
|
+
# FrontFaceDirection
|
57
|
+
GL_CW: 0x0900
|
58
|
+
GL_CCW: 0x0901
|
59
|
+
# GetPName
|
60
|
+
GL_POINT_SIZE: 0x0B11
|
61
|
+
GL_POINT_SIZE_RANGE: 0x0B12
|
62
|
+
GL_POINT_SIZE_GRANULARITY: 0x0B13
|
63
|
+
GL_LINE_SMOOTH: 0x0B20
|
64
|
+
GL_LINE_WIDTH: 0x0B21
|
65
|
+
GL_LINE_WIDTH_RANGE: 0x0B22
|
66
|
+
GL_LINE_WIDTH_GRANULARITY: 0x0B23
|
67
|
+
GL_POLYGON_MODE: 0x0B40
|
68
|
+
GL_POLYGON_SMOOTH: 0x0B41
|
69
|
+
GL_CULL_FACE: 0x0B44
|
70
|
+
GL_CULL_FACE_MODE: 0x0B45
|
71
|
+
GL_FRONT_FACE: 0x0B46
|
72
|
+
GL_DEPTH_RANGE: 0x0B70
|
73
|
+
GL_DEPTH_TEST: 0x0B71
|
74
|
+
GL_DEPTH_WRITEMASK: 0x0B72
|
75
|
+
GL_DEPTH_CLEAR_VALUE: 0x0B73
|
76
|
+
GL_DEPTH_FUNC: 0x0B74
|
77
|
+
GL_STENCIL_TEST: 0x0B90
|
78
|
+
GL_STENCIL_CLEAR_VALUE: 0x0B91
|
79
|
+
GL_STENCIL_FUNC: 0x0B92
|
80
|
+
GL_STENCIL_VALUE_MASK: 0x0B93
|
81
|
+
GL_STENCIL_FAIL: 0x0B94
|
82
|
+
GL_STENCIL_PASS_DEPTH_FAIL: 0x0B95
|
83
|
+
GL_STENCIL_PASS_DEPTH_PASS: 0x0B96
|
84
|
+
GL_STENCIL_REF: 0x0B97
|
85
|
+
GL_STENCIL_WRITEMASK: 0x0B98
|
86
|
+
GL_VIEWPORT: 0x0BA2
|
87
|
+
GL_DITHER: 0x0BD0
|
88
|
+
GL_BLEND_DST: 0x0BE0
|
89
|
+
GL_BLEND_SRC: 0x0BE1
|
90
|
+
GL_BLEND: 0x0BE2
|
91
|
+
GL_LOGIC_OP_MODE: 0x0BF0
|
92
|
+
GL_COLOR_LOGIC_OP: 0x0BF2
|
93
|
+
GL_DRAW_BUFFER: 0x0C01
|
94
|
+
GL_READ_BUFFER: 0x0C02
|
95
|
+
GL_SCISSOR_BOX: 0x0C10
|
96
|
+
GL_SCISSOR_TEST: 0x0C11
|
97
|
+
GL_COLOR_CLEAR_VALUE: 0x0C22
|
98
|
+
GL_COLOR_WRITEMASK: 0x0C23
|
99
|
+
GL_DOUBLEBUFFER: 0x0C32
|
100
|
+
GL_STEREO: 0x0C33
|
101
|
+
GL_LINE_SMOOTH_HINT: 0x0C52
|
102
|
+
GL_POLYGON_SMOOTH_HINT: 0x0C53
|
103
|
+
GL_UNPACK_SWAP_BYTES: 0x0CF0
|
104
|
+
GL_UNPACK_LSB_FIRST: 0x0CF1
|
105
|
+
GL_UNPACK_ROW_LENGTH: 0x0CF2
|
106
|
+
GL_UNPACK_SKIP_ROWS: 0x0CF3
|
107
|
+
GL_UNPACK_SKIP_PIXELS: 0x0CF4
|
108
|
+
GL_UNPACK_ALIGNMENT: 0x0CF5
|
109
|
+
GL_PACK_SWAP_BYTES: 0x0D00
|
110
|
+
GL_PACK_LSB_FIRST: 0x0D01
|
111
|
+
GL_PACK_ROW_LENGTH: 0x0D02
|
112
|
+
GL_PACK_SKIP_ROWS: 0x0D03
|
113
|
+
GL_PACK_SKIP_PIXELS: 0x0D04
|
114
|
+
GL_PACK_ALIGNMENT: 0x0D05
|
115
|
+
GL_MAX_TEXTURE_SIZE: 0x0D33
|
116
|
+
GL_MAX_VIEWPORT_DIMS: 0x0D3A
|
117
|
+
GL_SUBPIXEL_BITS: 0x0D50
|
118
|
+
GL_TEXTURE_1D: 0x0DE0
|
119
|
+
GL_TEXTURE_2D: 0x0DE1
|
120
|
+
GL_POLYGON_OFFSET_UNITS: 0x2A00
|
121
|
+
GL_POLYGON_OFFSET_POINT: 0x2A01
|
122
|
+
GL_POLYGON_OFFSET_LINE: 0x2A02
|
123
|
+
GL_POLYGON_OFFSET_FILL: 0x8037
|
124
|
+
GL_POLYGON_OFFSET_FACTOR: 0x8038
|
125
|
+
GL_TEXTURE_BINDING_1D: 0x8068
|
126
|
+
GL_TEXTURE_BINDING_2D: 0x8069
|
127
|
+
# GetTextureParameter
|
128
|
+
GL_TEXTURE_WIDTH: 0x1000
|
129
|
+
GL_TEXTURE_HEIGHT: 0x1001
|
130
|
+
GL_TEXTURE_INTERNAL_FORMAT: 0x1003
|
131
|
+
GL_TEXTURE_BORDER_COLOR: 0x1004
|
132
|
+
GL_TEXTURE_RED_SIZE: 0x805C
|
133
|
+
GL_TEXTURE_GREEN_SIZE: 0x805D
|
134
|
+
GL_TEXTURE_BLUE_SIZE: 0x805E
|
135
|
+
GL_TEXTURE_ALPHA_SIZE: 0x805F
|
136
|
+
# HintMode
|
137
|
+
GL_DONT_CARE: 0x1100
|
138
|
+
GL_FASTEST: 0x1101
|
139
|
+
GL_NICEST: 0x1102
|
140
|
+
# DataType
|
141
|
+
GL_BYTE: 0x1400
|
142
|
+
GL_UNSIGNED_BYTE: 0x1401
|
143
|
+
GL_SHORT: 0x1402
|
144
|
+
GL_UNSIGNED_SHORT: 0x1403
|
145
|
+
GL_INT: 0x1404
|
146
|
+
GL_UNSIGNED_INT: 0x1405
|
147
|
+
GL_FLOAT: 0x1406
|
148
|
+
GL_DOUBLE: 0x140A
|
149
|
+
# ErrorCode
|
150
|
+
GL_STACK_OVERFLOW: 0x0503
|
151
|
+
GL_STACK_UNDERFLOW: 0x0504
|
152
|
+
# LogicOp
|
153
|
+
GL_CLEAR: 0x1500
|
154
|
+
GL_AND: 0x1501
|
155
|
+
GL_AND_REVERSE: 0x1502
|
156
|
+
GL_COPY: 0x1503
|
157
|
+
GL_AND_INVERTED: 0x1504
|
158
|
+
GL_NOOP: 0x1505
|
159
|
+
GL_XOR: 0x1506
|
160
|
+
GL_OR: 0x1507
|
161
|
+
GL_NOR: 0x1508
|
162
|
+
GL_EQUIV: 0x1509
|
163
|
+
GL_INVERT: 0x150A
|
164
|
+
GL_OR_REVERSE: 0x150B
|
165
|
+
GL_COPY_INVERTED: 0x150C
|
166
|
+
GL_OR_INVERTED: 0x150D
|
167
|
+
GL_NAND: 0x150E
|
168
|
+
GL_SET: 0x150F
|
169
|
+
# MatrixMode (for gl3.h, FBO attachment type)
|
170
|
+
GL_TEXTURE: 0x1702
|
171
|
+
# PixelCopyType
|
172
|
+
GL_COLOR: 0x1800
|
173
|
+
GL_DEPTH: 0x1801
|
174
|
+
GL_STENCIL: 0x1802
|
175
|
+
# PixelFormat
|
176
|
+
GL_STENCIL_INDEX: 0x1901
|
177
|
+
GL_DEPTH_COMPONENT: 0x1902
|
178
|
+
GL_RED: 0x1903
|
179
|
+
GL_GREEN: 0x1904
|
180
|
+
GL_BLUE: 0x1905
|
181
|
+
GL_ALPHA: 0x1906
|
182
|
+
GL_RGB: 0x1907
|
183
|
+
GL_RGBA: 0x1908
|
184
|
+
# PolygonMode
|
185
|
+
GL_POINT: 0x1B00
|
186
|
+
GL_LINE: 0x1B01
|
187
|
+
GL_FILL: 0x1B02
|
188
|
+
# StencilOp
|
189
|
+
GL_KEEP: 0x1E00
|
190
|
+
GL_REPLACE: 0x1E01
|
191
|
+
GL_INCR: 0x1E02
|
192
|
+
GL_DECR: 0x1E03
|
193
|
+
# StringName
|
194
|
+
GL_VENDOR: 0x1F00
|
195
|
+
GL_RENDERER: 0x1F01
|
196
|
+
GL_VERSION: 0x1F02
|
197
|
+
GL_EXTENSIONS: 0x1F03
|
198
|
+
# TextureMagFilter
|
199
|
+
GL_NEAREST: 0x2600
|
200
|
+
GL_LINEAR: 0x2601
|
201
|
+
# TextureMinFilter
|
202
|
+
GL_NEAREST_MIPMAP_NEAREST: 0x2700
|
203
|
+
GL_LINEAR_MIPMAP_NEAREST: 0x2701
|
204
|
+
GL_NEAREST_MIPMAP_LINEAR: 0x2702
|
205
|
+
GL_LINEAR_MIPMAP_LINEAR: 0x2703
|
206
|
+
# TextureParameterName
|
207
|
+
GL_TEXTURE_MAG_FILTER: 0x2800
|
208
|
+
GL_TEXTURE_MIN_FILTER: 0x2801
|
209
|
+
GL_TEXTURE_WRAP_S: 0x2802
|
210
|
+
GL_TEXTURE_WRAP_T: 0x2803
|
211
|
+
# TextureTarget
|
212
|
+
GL_PROXY_TEXTURE_1D: 0x8063
|
213
|
+
GL_PROXY_TEXTURE_2D: 0x8064
|
214
|
+
# TextureWrapMode
|
215
|
+
GL_REPEAT: 0x2901
|
216
|
+
# PixelInternalFormat
|
217
|
+
GL_R3_G3_B2: 0x2A10
|
218
|
+
GL_RGB4: 0x804F
|
219
|
+
GL_RGB5: 0x8050
|
220
|
+
GL_RGB8: 0x8051
|
221
|
+
GL_RGB10: 0x8052
|
222
|
+
GL_RGB12: 0x8053
|
223
|
+
GL_RGB16: 0x8054
|
224
|
+
GL_RGBA2: 0x8055
|
225
|
+
GL_RGBA4: 0x8056
|
226
|
+
GL_RGB5_A1: 0x8057
|
227
|
+
GL_RGBA8: 0x8058
|
228
|
+
GL_RGB10_A2: 0x8059
|
229
|
+
GL_RGBA12: 0x805A
|
230
|
+
GL_RGBA16: 0x805B
|