ruby-opengl 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +129 -0
- data/doc/build_install.txt +53 -0
- data/doc/history.txt +48 -0
- data/doc/requirements_and_design.txt +131 -0
- data/doc/roadmap.txt +19 -0
- data/doc/scientific_use.txt +28 -0
- data/doc/supplies/page_template.html +63 -0
- data/doc/thanks.txt +23 -0
- data/doc/tutorial.txt +160 -0
- data/examples/README +36 -0
- data/examples/aaindex.rb +97 -0
- data/examples/all_tests.rb +24 -0
- data/examples/plane.rb +161 -0
- data/examples/smooth.rb +40 -0
- data/examples/smooth_prev.rb +40 -0
- data/examples/test.rb +64 -0
- data/ext/common/Rakefile +39 -0
- data/ext/common/gl-enums.h +10349 -0
- data/ext/common/rbogl.c +260 -0
- data/ext/common/rbogl.h +52 -0
- data/ext/gl/gl-1.0-1.1.c +5152 -0
- data/ext/gl/gl-1.2.c +166 -0
- data/ext/gl/gl-enums.c +2905 -0
- data/ext/gl/gl.c +31 -0
- data/ext/gl/mkrf_conf.rb +27 -0
- data/ext/glu/glu.c +1636 -0
- data/ext/glu/mkrf_conf.rb +28 -0
- data/ext/glut/glut.c +1776 -0
- data/ext/glut/mkrf_conf.rb +28 -0
- data/lib/gl_prev.rb +45 -0
- data/lib/glu_prev.rb +45 -0
- data/lib/glut_prev.rb +45 -0
- data/test/README +23 -0
- data/test/runtests.sh +7 -0
- data/test/tc_gl_vertex.rb +180 -0
- data/test/tc_include_gl.rb +35 -0
- data/test/tc_opengl_namespace.rb +40 -0
- data/test/tc_require_gl.rb +34 -0
- metadata +96 -0
data/ext/gl/gl-1.2.c
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 1999 - 2005 Yoshi <yoshi@giganet.net>
|
3
|
+
* Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
|
4
|
+
*
|
5
|
+
* This program is distributed under the terms of the MIT license.
|
6
|
+
* See the included MIT-LICENSE file for the terms of this license.
|
7
|
+
*
|
8
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
9
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
10
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
11
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
12
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
13
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
14
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#ifdef __APPLE__
|
18
|
+
#include <OpenGL/gl.h>
|
19
|
+
#elif defined WIN32
|
20
|
+
#include <windows.h>
|
21
|
+
#include <GL/gl.h>
|
22
|
+
#else
|
23
|
+
#include <GL/gl.h>
|
24
|
+
#endif
|
25
|
+
#include "../common/rbogl.h"
|
26
|
+
#include "../common/gl-enums.h"
|
27
|
+
|
28
|
+
/* OpenGL 1.2 functions */
|
29
|
+
|
30
|
+
/*
|
31
|
+
VALUE
|
32
|
+
gl_DrawRangeElements(obj,arg1,arg2,arg3,arg4,arg5,arg6)
|
33
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6;
|
34
|
+
{
|
35
|
+
GLenum mode;
|
36
|
+
GLuint start;
|
37
|
+
GLuint end;
|
38
|
+
GLsizei count;
|
39
|
+
GLenum type;
|
40
|
+
mode = (GLenum)NUM2INT(arg1);
|
41
|
+
start = (GLuint)NUM2INT(arg2);
|
42
|
+
end = (GLuint)NUM2INT(arg3);
|
43
|
+
count = (GLsizei)NUM2INT(arg4);
|
44
|
+
type = (GLenum)NUM2INT(arg5);
|
45
|
+
Check_Type(arg6, T_STRING);
|
46
|
+
glDrawRangeElements(mode, start, end, count, type, RSTRING(arg6)->ptr);
|
47
|
+
return Qnil;
|
48
|
+
}
|
49
|
+
VALUE
|
50
|
+
gl_TexImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10)
|
51
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10;
|
52
|
+
{
|
53
|
+
GLenum target;
|
54
|
+
GLint level;
|
55
|
+
GLint internalFormat;
|
56
|
+
GLsizei width;
|
57
|
+
GLsizei height;
|
58
|
+
GLsizei depth;
|
59
|
+
GLint border;
|
60
|
+
GLenum format;
|
61
|
+
GLenum type;
|
62
|
+
int size;
|
63
|
+
int type_size;
|
64
|
+
int format_size;
|
65
|
+
target = (GLenum)NUM2INT(arg1);
|
66
|
+
level = (GLint)NUM2INT(arg2);
|
67
|
+
internalFormat = (GLint)NUM2INT(arg3);
|
68
|
+
width = (GLsizei)NUM2INT(arg4);
|
69
|
+
height = (GLsizei)NUM2INT(arg5);
|
70
|
+
depth = (GLsizei)NUM2INT(arg6);
|
71
|
+
border = (GLint)NUM2INT(arg7);
|
72
|
+
format = (GLenum)NUM2INT(arg8);
|
73
|
+
type = (GLenum)NUM2INT(arg9);
|
74
|
+
Check_Type(arg10, T_STRING);
|
75
|
+
type_size = gltype_size(type) / 8;
|
76
|
+
format_size = glformat_size(format);
|
77
|
+
if (type_size == -1 || format_size == -1)
|
78
|
+
return Qnil;
|
79
|
+
size = type_size*format_size*height*width*depth;
|
80
|
+
if (RSTRING(arg10)->len < size)
|
81
|
+
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg10)->len);
|
82
|
+
glTexImage3D( target, level, internalFormat, width, height,
|
83
|
+
depth, border, format, type,
|
84
|
+
(const GLvoid*)RSTRING(arg10)->ptr);
|
85
|
+
return Qnil;
|
86
|
+
}
|
87
|
+
VALUE
|
88
|
+
gl_TexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)
|
89
|
+
VALUE arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11;
|
90
|
+
{
|
91
|
+
GLenum target;
|
92
|
+
GLint level;
|
93
|
+
GLint xoffset;
|
94
|
+
GLint yoffset;
|
95
|
+
GLint zoffset;
|
96
|
+
GLsizei width;
|
97
|
+
GLsizei height;
|
98
|
+
GLsizei depth;
|
99
|
+
GLenum format;
|
100
|
+
GLenum type;
|
101
|
+
int size;
|
102
|
+
int type_size;
|
103
|
+
int format_size;
|
104
|
+
target = (GLenum)NUM2INT(arg1);
|
105
|
+
level = (GLint)NUM2INT(arg2);
|
106
|
+
xoffset = (GLint)NUM2INT(arg3);
|
107
|
+
yoffset = (GLint)NUM2INT(arg4);
|
108
|
+
zoffset = (GLint)NUM2INT(arg5);
|
109
|
+
width = (GLsizei)NUM2INT(arg6);
|
110
|
+
height = (GLsizei)NUM2INT(arg7);
|
111
|
+
depth = (GLsizei)NUM2INT(arg8);
|
112
|
+
format = (GLenum)NUM2INT(arg9);
|
113
|
+
type = (GLenum)NUM2INT(arg10);
|
114
|
+
Check_Type(arg11, T_STRING);
|
115
|
+
type_size = gltype_size(type) / 8;
|
116
|
+
format_size = glformat_size(format);
|
117
|
+
if (type_size == -1 || format_size == -1)
|
118
|
+
return Qnil;
|
119
|
+
size = type_size*format_size*height*width*depth;
|
120
|
+
if (RSTRING(arg11)->len < size)
|
121
|
+
rb_raise(rb_eArgError, "string length:%d",RSTRING(arg11)->len);
|
122
|
+
glTexSubImage3D( target, level, xoffset, yoffset, zoffset,
|
123
|
+
width, height, depth,
|
124
|
+
format, type, RSTRING(arg11)->ptr);
|
125
|
+
return Qnil;
|
126
|
+
}
|
127
|
+
VALUE
|
128
|
+
gl_CopyTexSubImage3D(obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
|
129
|
+
VALUE obj,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9;
|
130
|
+
{
|
131
|
+
GLenum target;
|
132
|
+
GLint level;
|
133
|
+
GLint xoffset;
|
134
|
+
GLint yoffset;
|
135
|
+
GLint zoffset;
|
136
|
+
GLint x;
|
137
|
+
GLint y;
|
138
|
+
GLsizei width;
|
139
|
+
GLsizei height;
|
140
|
+
target = (GLenum)NUM2INT(arg1);
|
141
|
+
level = (GLint)NUM2INT(arg2);
|
142
|
+
xoffset = (GLint)NUM2INT(arg3);
|
143
|
+
yoffset = (GLint)NUM2INT(arg4);
|
144
|
+
zoffset = (GLint)NUM2INT(arg5);
|
145
|
+
x = (GLint)NUM2INT(arg6);
|
146
|
+
y = (GLint)NUM2INT(arg7);
|
147
|
+
width = (GLsizei)NUM2INT(arg8);
|
148
|
+
height = (GLsizei)NUM2INT(arg9);
|
149
|
+
glCopyTexSubImage3D( target, level,
|
150
|
+
xoffset, yoffset, zoffset,
|
151
|
+
x, y, width, height );
|
152
|
+
return Qnil;
|
153
|
+
}
|
154
|
+
*/
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
void gl_init_functions_1_2(VALUE module)
|
159
|
+
{
|
160
|
+
/*
|
161
|
+
rb_define_module_function(module, "glDrawRangeElements", gl_DrawRangeElements, 6);
|
162
|
+
rb_define_module_function(module, "glTexImage3D", gl_TexImage3D, 10);
|
163
|
+
rb_define_module_function(module, "glTexSubImage3D", gl_TexSubImage3D, 11);
|
164
|
+
rb_define_module_function(module, "glCopyTexSubImage3D", gl_CopyTexSubImage3D, 9);
|
165
|
+
*/
|
166
|
+
}
|