Start a new topic

Bugs inside native SDK and native examples

Bugs inside native SDK and native examples


Hi,

I just noticed some issues in your iOS native SDK and its examples (only checked the simple internal renderer example):

- the observers for app-(de)activation are installed inside viewDidLoad and uninstalled inside viewDidDisappear. This has the effect that the respective methods won't be called anymore once you leave the respective viewcontroller via navigation inside the app and then provoke an app-de/re-activation. This again leads to invalid OGL objects, simply spoken: the markers are gone.

- in viewDidDisappear a call to the marker's releaseShaders is missing which again leads to broken markers if you navigate from and back to that viewcontroller.

- general SDK issue: if using the trial licence the TRIAL overlay will be broken if you leave the AR view. Instead you get to see a black triangle. Apparently you are simply overlaying a textured triangle strip and forget to destroy/recreate the texture if necessary?

Best regards,
Daniel

Hi again,

with the bug revealing the information about how you do your "TRIAL" overlay, it's of course just a matter of less than 10 lines of code to hack it away by replacing that texture's image with fully transparent texels...
Actually you don't even have to scan through the texture-IDs because it's the one currently bound when the draw-marker-callback is called for the first time with a bound texture.

Sourcecode anyone? ;)
I didn't try it on Android yet but I suppose it's equally easy there.

I suppose you'll fix that *very* quickly :)
PLEASE also fix the Android onFinishTargetLoad semantics while you're there too!

- (WTCustomDrawHandler)wikitudeNativeSDKNeedsExternalDrawHandler:(WTWikitudeNativeSDK * __nonnull)wikitudeNativeSDK
{
    __weak typeof(self) weakSelf = self;
    return ^(){
// HACK START
      static bool hacked=false; // usually you want that to be a global that's being resetted on context recreation of course
      if(!hacked) {
        GLuint tex_id=0;
        glGetIntegerv(GL_TEXTURE_BINDING_2D,(GLint*)&tex_id);
        if(tex_id) {
          hacked=true;
          GLubyte trans={0,0,0,0};
          glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,1,1,0,GL_RGBA,GL_UNSIGNED_BYTE,trans);
        }
      }else
// HACK END
       {
      
        if ( weakSelf.isTracking ) {
            ;
        }
      }
    };
}


Cheers,
Daniel

Hi again,

hints how you should do the TRIAL overlay to avoid easy hacking:

- unbind the texture after usage.
- don't use texture-ID 1 / glGenTextures for the overlay. Use a random number instead.
- change the texture-ID every few minutes by doing something like this:

glDeleteTextures(1,&overlay_texture);
do {
    overlay_texture=rand()|1024;
}while(!glIsTexture(overlay_texture));
glBindTexture(overlay_texture);
glTexImage2D(...)
glBindTexture(0);

This should make a trivial hack approach almost impossible.
Scanning through all texture-IDs simply takes too long (some ten minutes or so on current iPhones, I guess).

Probably the overlay's shader-program can be attacked in a similar way like the texture,
so you should probably do the same for that too.

Cheers,
Daniel
Login or Signup to post a comment