By ashunkhs
on Tue, 02/05/2013 - 13:42
HI dude
I have to make the texture dynamically .
i tried to do this with the help of this link : https://developer.vuforia.com/forum/faq/android-how-do-i-add-textures-my-model
but i am getting black texture .
JNIEXPORT void JNICALLJava_com_adstuck_times_iar_VideoPlayback_createGLTextureNative( JNIEnv* env, jobject obj, jobject textureObjectNew){ if (textureObjectNew != NULL) { myTexture = Texture::create(env, textureObjectNew); glGenTextures(1, &(myTexture->mTextureID)); glBindTexture(GL_TEXTURE_2D, myTexture->mTextureID); // if ( myTexture->mTextureID != NULL) { LOG("texture is not nulllllllll =======================>"); // here i got the print statement. } glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, myTexture->mWidth, myTexture->mHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,(GLvoid*) myTexture->mData); LOG("dynamic texture created ############################"); // here i got the print statement }} but when i use it ............... void renderTransitionTo2D(){ checkRender=false; if (startTransition3Dto2D){ // Starts the Transitiontransition3Dto2D->startTransition(transitionDuration, false, true);LOG("if startTransition3Dto2D is true-------------------------------->");// Initialize control state variablesstartTransition3Dto2D = false; }else{ //if (textures[0]->mTextureID != 0 )//if ( myTexture->mTextureID != NULL){ transition3Dto2D->render(projectionMatrix, pose, myTexture->mTextureID); // hete i used it as a texture LOG("if startTransition3Dto2D is false-------------------------------->");// check if transition is finishedif (transition3Dto2D->transitionFinished() ){isShowing2DOverlay = true; }}} finally i got black texture.. pls help......
create texturer dynamically
hi, you should check a few things:
create texturer dynamically
Hi Aless..
I checked all three cases ..
create texturer dynamically
Ok, good, so we now know that the texture has not been created properly;
if you look at your code:
create texturer dynamically
Hi aless
i am getting the error :
: E/libEGL(32702): call to OpenGL ES API with no current context (logged once per thread)
between
create texturer dynamically
OK, this error message is clarifying the issue quite a bit:
create texturer dynamically
thanks dude...
i did all GL works in renderFrame .Now i m able to create texture dynamically ...
create texturer dynamically
Great!
create texturer dynamically
Hi,
create texturer dynamically
And the moment i posted question, i found the answer :)
Just changing this line was enough to make it all work.
Thanks a lot :)
currentTextureObject = env->NewGlobalRef(textureObj);
Hi! I just solved this
Hi! I just solved this problem and I'd like to share my methods with you. The key problem is not about the texture size( it doesn't need to be size of power of 2).