582 |
releaseWindow(); |
releaseWindow(); |
583 |
} |
} |
584 |
|
|
585 |
|
Texture::TextureParam textureParams(JNIEnv *env, jobjectArray params) { |
586 |
|
|
587 |
|
Texture::TextureParam p; |
588 |
|
|
589 |
|
for(int i=0; i<env->GetArrayLength(params)-1; i+=2) { |
590 |
|
std::string k = jstr2stdstr(env, (jstring)(env->GetObjectArrayElement(params, i))); |
591 |
|
std::string v = jstr2stdstr(env, (jstring)(env->GetObjectArrayElement(params, i+1))); |
592 |
|
p.setParam(k.c_str(), v.c_str()); |
593 |
|
} |
594 |
|
|
595 |
|
return p; |
596 |
|
} |
597 |
|
|
598 |
JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1shade |
JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1Texture_1shade |
599 |
(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, |
600 |
jstring internalFormat, |
jstring internalFormat, |
611 |
return 0; |
return 0; |
612 |
} |
} |
613 |
|
|
614 |
Texture::TextureParam p; |
Texture::TextureParam p = textureParams(env, params); |
|
|
|
|
for(int i=0; i<env->GetArrayLength(params)-1; i+=2) { |
|
|
std::string k = jstr2stdstr(env, (jstring)(env->GetObjectArrayElement(params, i))); |
|
|
std::string v = jstr2stdstr(env, (jstring)(env->GetObjectArrayElement(params, i+1))); |
|
|
p.setParam(k.c_str(), v.c_str()); |
|
|
} |
|
615 |
|
|
616 |
float *value = new float[w * h * (d==0?1:d) * comp]; |
float *value = new float[w * h * (d==0?1:d) * comp]; |
617 |
|
|
913 |
} |
} |
914 |
|
|
915 |
|
|
916 |
|
JNIEXPORT jint JNICALL Java_gzz_gfx_gl_GL_impl_1ByteVector_1shade |
917 |
|
(JNIEnv *env, jclass, jint id, jint w, jint h, jint d, jint comp, |
918 |
|
jstring name, jobjectArray params) { |
919 |
|
setWindow(); |
920 |
|
DBG(dbg)<<"Shade into "<<id<<"\n"; |
921 |
|
|
922 |
|
std::string name_utf = jstr2stdstr(env, name); |
923 |
|
|
924 |
|
Texture::Texture *s = Texture::Texture::getTexture(name_utf.c_str()); |
925 |
|
|
926 |
|
if(!s) { |
927 |
|
return 0; |
928 |
|
} |
929 |
|
|
930 |
|
Texture::TextureParam p = textureParams(env, params); |
931 |
|
|
932 |
|
bytevectors[id]->resize(w * h * (d==0 ? 1 : d) * comp * 4); |
933 |
|
s->render( &p, w, h, (d==0?1:d), comp, (float*)&((*bytevectors[id])[0])); |
934 |
|
return 1; |
935 |
|
} |
936 |
|
|
937 |
|
|
938 |
// Renderable |
// Renderable |
939 |
|
|
940 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable0 |
JNIEXPORT void JNICALL Java_gzz_gfx_gl_GL_deleteRenderable0 |