1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
static const char _glu_n_a_string[] = "GLU-String not avaiable !";
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_gluErrorString ( JNIEnv *env, jobject obj,
jint errorCode )
{
const char *tmpString=0;
tmpString = gluErrorString ( /* jint */ errorCode );
if(tmpString==NULL)
tmpString=_glu_n_a_string;
return (*env)->NewStringUTF(env, tmpString);
}
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_gluGetString ( JNIEnv *env, jobject obj,
jint name )
{
const char *tmpString=0;
tmpString = gluGetString ( /* jint */ name);
if(tmpString==NULL)
tmpString=_glu_n_a_string;
return (*env)->NewStringUTF(env, tmpString);
}
static const char * _glu_lib_vendor_="Jausoft - Sven Goethel Software Development";
static const char * _glu_lib_version_="2.5.2.0";
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_getNativeVendor ( JNIEnv *env, jobject obj )
{
return (*env)->NewStringUTF(env, _glu_lib_vendor_);
}
JNIEXPORT jstring JNICALL
Java_gl4java_GLUFuncJauJNI_getNativeVersion ( JNIEnv *env, jobject obj )
{
return (*env)->NewStringUTF(env, _glu_lib_version_);
}
static void _AddCallbackNode(JNIEnv *env,
jlong qnt_obj, jint which,
jobject methodClassInstance,
jstring methodName,
jstring signature,
jint arrayLen1,
jint arrayLen2,
jint arrayLen3,
jint arrayLen4,
jint arrayLen5)
{
char * strMethodName = jnitoolsGetJavaString(env, methodName);
char * strSignature = jnitoolsGetJavaString(env, signature);
jlong glx=0;
glx = GetCurrentGLContext();
AddCallbackNode(env, methodClassInstance, strMethodName, strSignature,
arrayLen1, arrayLen2, arrayLen3,
arrayLen4, arrayLen5,
(void *)((PointerHolder)qnt_obj), which, glx);
free(strMethodName);
free(strSignature);
}
JNIEXPORT void JNICALL
Java_gl4java_GLUFuncJauJNI_gluQuadricCallback( JNIEnv *env, jobject obj,
jlong qobj, jint which,
jobject methodClassInstance,
jstring methodName,
jstring signature)
{
switch(which)
{
case GLU_ERROR:
gluQuadricCallback((void *)((PointerHolder)qobj),
which, cbf_GLU_ERROR );
break;
default:
jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
return;
}
_AddCallbackNode(env,
qobj, which, methodClassInstance, methodName,
signature,
0, 0, 0, 0, 0);
}
JNIEXPORT void JNICALL
Java_gl4java_GLUFuncJauJNI_gluNurbsCallback( JNIEnv *env, jobject obj,
jlong nobj, jint which,
jobject methodClassInstance,
jstring methodName,
jstring signature)
{
switch(which)
{
case GLU_ERROR:
gluNurbsCallback((void *)((PointerHolder)nobj), which,
cbf_GLU_ERROR );
break;
default:
jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
return;
}
_AddCallbackNode(env,
nobj, which, methodClassInstance, methodName,
signature,
0, 0, 0, 0, 0);
}
JNIEXPORT void JNICALL
Java_gl4java_GLUFuncJauJNI_gluTessCallback( JNIEnv *env, jobject obj,
jlong tobj, jint which,
jobject methodClassInstance,
jstring methodName,
jstring signature,
jint arrayLen1,
jint arrayLen2,
jint arrayLen3,
jint arrayLen4,
jint arrayLen5)
{
switch(which)
{
case GLU_TESS_BEGIN:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_BEGIN );
break;
case GLU_TESS_BEGIN_DATA:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_BEGIN_DATA );
break;
case GLU_TESS_EDGE_FLAG:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_EDGE_FLAG );
break;
case GLU_TESS_EDGE_FLAG_DATA:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_EDGE_FLAG_DATA );
break;
case GLU_TESS_VERTEX:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_VERTEX );
break;
case GLU_TESS_VERTEX_DATA:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_VERTEX_DATA );
break;
case GLU_TESS_END:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_END );
break;
case GLU_TESS_END_DATA:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_END_DATA );
break;
case GLU_TESS_ERROR:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_ERROR );
break;
case GLU_TESS_ERROR_DATA:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_ERROR_DATA );
break;
case GLU_TESS_COMBINE:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_COMBINE );
break;
case GLU_TESS_COMBINE_DATA:
gluTessCallback((GLUtesselator *)((PointerHolder)tobj),
which,
cbf_GLU_TESS_COMBINE_DATA );
break;
default:
jnitoolsThrowByName(env, "java/lang/IllegalArgumentException", "Wrong Callback-Function type (\"which\") !");
return;
}
_AddCallbackNode(env,
tobj, which, methodClassInstance, methodName,
signature,
arrayLen1, arrayLen2, arrayLen3,
arrayLen4, arrayLen5);
}
JNIEXPORT void JNICALL
Java_gl4java_GLUFuncJauJNI_gluDeleteQuadric( JNIEnv *env, jobject obj,
jlong qobj )
{
gluDeleteQuadric((void *)((PointerHolder)qobj));
RemoveCallbackNodes((void *)((PointerHolder)qobj));
}
JNIEXPORT void JNICALL
Java_gl4java_GLUFuncJauJNI_gluDeleteNurbsRenderer( JNIEnv *env, jobject obj,
jlong nobj )
{
gluDeleteNurbsRenderer((void *)((PointerHolder)nobj));
RemoveCallbackNodes((void *)((PointerHolder)nobj));
}
JNIEXPORT void JNICALL
Java_gl4java_GLUFuncJauJNI_gluDeleteTess( JNIEnv *env, jobject obj,
jlong tobj )
{
gluDeleteTess((GLUtesselator *)((PointerHolder)tobj));
RemoveCallbackNodes((void *)((PointerHolder)tobj));
}
JNIEXPORT jlong JNICALL
Java_gl4java_GLUFuncJauJNI_gluNewQuadric( JNIEnv *env, jobject obj)
{
return (jlong)((PointerHolder)gluNewQuadric());
}
JNIEXPORT jlong JNICALL
Java_gl4java_GLUFuncJauJNI_gluNewNurbsRenderer( JNIEnv *env, jobject obj)
{
return (jlong)((PointerHolder)gluNewNurbsRenderer());
}
JNIEXPORT jlong JNICALL
Java_gl4java_GLUFuncJauJNI_gluNewTess( JNIEnv *env, jobject obj)
{
return (jlong)((PointerHolder)gluNewTess());
}
|