275 |
w->addTimeout(ms, tid); |
w->addTimeout(ms, tid); |
276 |
} |
} |
277 |
|
|
278 |
|
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Window_1setCurrent |
279 |
|
(JNIEnv *env, jclass, jint id) { |
280 |
|
setWindow(id); |
281 |
|
} |
282 |
|
|
283 |
|
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Window_1release |
284 |
|
(JNIEnv *env, jclass, jint id) { |
285 |
|
releaseWindow(); |
286 |
|
} |
287 |
|
|
288 |
|
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Window_1move |
289 |
|
(JNIEnv *env, jclass, jint id, jint x, jint y) { |
290 |
|
windows.get(id)->move(x,y); |
291 |
|
} |
292 |
|
|
293 |
|
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Window_1resize |
294 |
|
(JNIEnv *env, jclass, jint id, jint w, jint h) { |
295 |
|
windows.get(id)->resize(w,h); |
296 |
|
} |
297 |
|
|
298 |
|
|
299 |
// ImageCache |
// ImageCache |
300 |
/* THIS DOES NOT COMPILE ON JDK 1.4 !!!!!! |
/* THIS DOES NOT COMPILE ON JDK 1.4 !!!!!! |
301 |
|
|
451 |
GLERR |
GLERR |
452 |
} |
} |
453 |
|
|
454 |
|
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Texture_1downsampleInto |
455 |
|
(JNIEnv *env, jclass, jint id, jint intoid, jstring targetstr, jint level, jstring internalFormat, jstring transferType) |
456 |
|
{ |
457 |
|
GLenum target = tokenFromJstring(env, targetstr); |
458 |
|
GLenum intern = tokenFromJstring(env, internalFormat); |
459 |
|
GLenum trans = tokenFromJstring(env, transferType); |
460 |
|
glBindTexture(target, id); |
461 |
|
GLint w=0,h=0; |
462 |
|
// XXX Only does 2D |
463 |
|
glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, &w); |
464 |
|
glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, &h); |
465 |
|
|
466 |
|
GLubyte *data = new GLubyte[w*h*4]; // assuming 4 components |
467 |
|
|
468 |
|
glPixelStorei(GL_PACK_ROW_LENGTH, 0); |
469 |
|
glPixelStorei(GL_PACK_ALIGNMENT, 1); |
470 |
|
glGetTexImage(target, level, trans, GL_UNSIGNED_BYTE, data); |
471 |
|
|
472 |
|
|
473 |
|
glBindTexture(target, intoid); |
474 |
|
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
475 |
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
476 |
|
glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); |
477 |
|
glTexImage2D(target, 0, intern, w, h, 0, trans, GL_UNSIGNED_BYTE, |
478 |
|
data); |
479 |
|
|
480 |
|
delete[] data; |
481 |
|
glBindTexture(target, 0); |
482 |
|
|
483 |
|
|
484 |
|
} |
485 |
|
|
486 |
JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Texture_1shade |
JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GZZGL_impl_1Texture_1shade |
487 |
(JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, |
(JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, |
488 |
jstring internalFormat, |
jstring internalFormat, |