Log in or register to post comments

Unable to load Right Texture after third texture

August 14, 2012 - 12:19am #1

 

Hi,

I have created application in which more than one images can be rendered 

 but when i renders fourth object its texture becomes transparent and fifth becomes dark black 

 some time fourth texture comes right and fifth becomes transparent 

some time sixth texture seems right but mostly only 3 texture loads well all other creats problem 

i have tried so many things but could not get the solution for this

can any one help?

thanks in advance.

Unable to load Right Texture after third texture

August 16, 2012 - 3:57am #6

What does the XCode log say when it is not working?

You will probably have to step through and debug what is going on, as mostly this is application specific - not really an issue with Vuforia ;) 

N

Unable to load Right Texture after third texture

August 16, 2012 - 3:32am #5

Hi NalinS ,

Thanks For your Reply;

Here is my init with frame method

- (id)initWithFrame:(CGRect)frame

{

  self = [super initWithFrame:frame];

  

if (self)

  {

    

    if ([qUtils targetType] == TYPE_FRAMEMARKERS) {

      // create list of textures we want loading - ARViewController will do this for us

      int nTextures = sizeof(textureFilenamesMT) / sizeof(textureFilenamesMT[0]);

      for (int i = 0; i < nTextures; ++i)

        [textureList addObject: [NSString stringWithUTF8String:textureFilenamesMT[i]]];

    }

    

    else if ([qUtils targetType] == TYPE_IMAGETARGETS){

      

      if ([qUtils target] == TYPE_VIRTUALBUTTONSN) {

        int nTextures = sizeof(textureFilenamesVB) / sizeof(textureFilenamesVB[0]);

        for (int i = 0; i < nTextures; ++i) {

          NSLog(@"texture file :%@",[NSString stringWithUTF8String:textureFilenamesVB[i]]);

          [textureList addObject: [NSString stringWithUTF8String:textureFilenamesVB[i]]];

        }

        

        buttonMask = 0;

        

      }

      else if ([qUtils target] == TYPE_DOMINOSN) {

        int nTextures = sizeof(textureFilenamesDom) / sizeof(textureFilenamesDom[0]);

        for (int i = 0; i < nTextures; ++i)

          [textureList addObject: [NSString stringWithUTF8String:textureFilenamesDom[i]]];

      }

      else if ([qUtils target] == TYPE_VIDEOPLAYERSN) {

        int nTextures = sizeof(textureFilenamesVP) / sizeof(textureFilenamesVP[0]);

        for (int i = 0; i < nTextures; ++i)

          [textureList addObject: [NSString stringWithUTF8String:textureFilenamesVP[i]]];

        

        

        // Ensure touch events go to the view controller, rather than directly

        // to this view

        self.userInteractionEnabled = NO;

        

        // For each target, create a VideoPlayerHelper object and zero the

        // target dimensions

        for (int i = 0; i < NUM_VIDEO_TARGETS; ++i) {

          videoPlayerHelper[i] = [[VideoPlayerHelper alloc] init];

          

          videoData[i].targetPositiveDimensions.data[0] = 0.0f;

          videoData[i].targetPositiveDimensions.data[1] = 0.0f;

        }

        

        dataLock = [[NSLock alloc] init];

      }

      else if ([qUtils target] == TYPE_IMAGETARGETSN2D) {

        int nTextures = sizeof(textureFilenamesForImageTarget2D) / sizeof(textureFilenamesForImageTarget2D[0]);

        for (int i = 0; i < nTextures; ++i)

          [textureList addObject: [NSString stringWithUTF8String:textureFilenamesForImageTarget2D[i]]];

      }

      else {

        int nTextures = sizeof(textureFilenamesForImageTarget) / sizeof(textureFilenamesForImageTarget[0]);

        for (int i = 0; i < nTextures; ++i)

          [textureList addObject: [NSString stringWithUTF8String:textureFilenamesForImageTarget[i]]];

      }

      // create list of textures we want loading - ARViewController will do this for us

      

    }

    

  }

  return self;

}

 

 

in which i loads textures according to target ,

image is definitely in bundle.

(how to put code sense in post, tell me so code would be readable for you) 

Thanks

 

Unable to load Right Texture after third texture

August 16, 2012 - 3:00am #4

Not sure what the problem is but you should be able to add textures to this array.  I built a sample recently which cycled through around 70 different textures, and these should get initialised in initWithFrame()  while loadTextures() should not need to change at all

You might just need to debug it through - there has to be a reason it's not working.

What does the xcode log say?

The other thing you might like to check is whether that green texture is actually in the Copy Bundle Resources?

N

Unable to load Right Texture after third texture

August 15, 2012 - 11:13pm #3

Hi NalinS ,

  My application is uses four examples of Vuforia (imageTarget,FrameMarker,VideoPlayer,VirtualButtons),I shows them one by one with my own 3D objects

  so every time i changes target ,FrameMarker Type etc.

  I reloads QCARUtils and all..

and I m sure size is not the issue.

 

 // Teapot texture filenames

 

  const char* textureFilenamesVB[] = {

    

    "TextureTeapotBrass.png",

    "TextureTeapotRed.png",

    "TextureTeapotBlue.png",

    "TextureTeapotYellow.png",// some times this also creats problem

    "TextureTeapotGreen.png",//this will create problem 

    "TextureTeapotGreen.png",//this will create problem 

    "TextureTeapotGreen.png",//this will create problem 

    "TextureTeapotGreen.png",//this will create problem 

    "TextureTeapotGreen.png"//this will create problem 

  };

 

 

if you will reorder the image name ,the image coming at fifth position will create problem ,no matter which image it is

 

As i think when we loads textures 

some thing goes wrong with this method but dont know what...

 

- (int)loadTextures:(NSArray *)textureList

{

    int nErr = noErr;

    int nTextures = [textureList count];

    textures = [[NSMutableArray array] retain];

    

    @try {

        for (int i = 0; i < nTextures; ++i) {

            Texture* tex = [[[Texture alloc] init] autorelease];

            NSString* file = [textureList objectAtIndex:i];

            

            nErr = [tex loadImage:file] == YES ? noErr : 1;

            

            [textures addObject:tex];

            

            if (noErr != nErr) {

                break;

            }

        }

    }

    @catch (NSException* e) {

        NSLog(@"NSMutableArray addObject exception");

    }

    

    assert([textures count] == nTextures);

    if ([textures count] != nTextures) {

        nErr = 1;

    }

    

    return nErr;

}

 

 

Ask me if any other information you require..

Thanks.

Unable to load Right Texture after third texture

August 14, 2012 - 5:56am #2

Can you provide some more information as to what you are trying to do as it is not clear to me.

Also, are the textures a power of 2 size?

N

Log in or register to post comments