5 Replies Latest reply on May 24, 2007 7:26 PM by braddini

    Loading dynamic  3d textures from cast member images

      Im having a problem loading textures or any image file into a libray and then trying to apply the image to a texture on a 3d model
      pardon me im not on the computer that has the code so i cant post it at the moment.

      I have a list of the images that i pass into to the player.
      i then loop over the list using the netpreloadthingy wait for the net done option
      create a member and assign the filepath and other setting for the cast member.

      this works fine in Director but after i publish it , it gives me an error , which i narrowed down to where the image is applied to the texture.

      first i though the image was too big and made smaller images
      still did not work.

      tryed to run it on a different computer and still did not work.

      I thought it might be that the image is not loaded all the way before it reaches where I apply it to the texture
      so on a sepreted frame i wrote a routine to check and see if the media was ready on each of the images. and had it write to the screen which images were not loaded.

      Sometimes half the images would load , then next run it was the others.

      My question is what is the best way to load dynamic images for textures . And i know about the power of 2 thing. I just need a way to load these images an ensue that they are there before i apply them to the model.

      Please help i have been fighting this for about 3 weeks now.

      Thanks in advance.

        • 1. Re: Loading dynamic  3d textures from cast member images
          James Newton, ACP Level 3
          Are you publishing as a projector, or as a Shockwave movie? You say you are checking for netDone; are you also checking for a netError?

          Are you using a unique name for the texture? If you try to create a newTexture with an existing name, Director will complain that an object with that name already exists.

          Have you tried using bitmaps that already exist in a castLib, rather than using downloaded and linked images? This will allow you to determine whether the error is due to the download or to the creation of the texture.

          What are your assumptions? Can you test which of your assumptions is incorrect?
          • 2. Re: Loading dynamic  3d textures from cast member images
            braddini Level 1
            I have been publishing to both the projector and shockwave movie. both have the same issue more so on the movie.
            yes i am checking for netdone but not checking for neterror .... (will look into that tonight)
            i am using unique names and i also do a check to see if the the member and the texture exist if it does then i just assign the setting to the existing item.

            i havnt tryed using existing bitmaps in the cast lib, i was trying to keep everything dynamic as for as images. I realy think that some of the images is not fulling loaded before i apply the texture. I will add the neterror section to my code tonight and see if im getting an error.

            i did try this last night i change from using the preloadnetthing to downloadnetthing and seem to get a better result. What is the major difference in these functions? Also In a shockwave movie, does the client have to have the images on there computer for the movie to use them. Not quit shure how shockwave handles images. Does it kind of work like a broswer the images are dl to the clients computer and then displayed on a web page?
            • 3. Re: Loading dynamic  3d textures from cast member images
              Are the files on your hdd, or are you downloading them first and then add it to your scene?

              I had a similar problem some time ago, i wanted to download a jpg from the net and add it as a texture in the scene, if the pict were on the hdd it was ok else i got an error, it told me that the picture was not there even if i got that it was all downloaded

              ( if getstreamstatus(netid).bytessofar < getstreamstatus(netid).bytestotal)

              then i saw that the code wasn't working in the same frame... I split them in more frames and all worked fine.

              First I checked if the file I want to download was not there and made a list of the files I wanted to download.
              Then on the next frame is started the download

              " netid = downloadnetthing(tpath,the applicationpath&string(fname)) "

              on the next frame I checked the status of the download

              if getstreamstatus(netid).bytessofar < getstreamstatus(netid).bytestotal then
              go to marker("checkdownload")
              end if

              If the file was not ready ... go back till it is ready

              In the next frame i imported the file...

              repeat with dwnnr = 1 to downloadname.count
              _movie.newmember(#bitmap).importfileinto(the applicationpath&string(downloadname[dwnnr]))
              end repeat

              and after this I could use the bitmaps as I wished , the problem was that the file, even if it was downloaded, it wasn't in the specified place till i exited the frame and entered a new one.

              It's hard for me to explain this if you think this may be the problem I can try to explain better or sand the entire code(not commented).

              As far as I know the downloadNetThing can not be used in shockwave, only in projector.

              good luck.

              • 4. Re: Loading dynamic  3d textures from cast member images
                braddini Level 1
                all the files are on my dev server and im using the full http path to get to the images.

                now im not using the importfileinto. do I need to use this to assign the data to the castmember

                attached is my code for this process
                • 5. Re: Loading dynamic  3d textures from cast member images
                  braddini Level 1
                  I got it!!!!
                  The images were not beeing loaded fully , and i didnt have code in place to check this. i do now
                  i added the code to check the filesize and let it run and it worked !!!!
                  Thanks everyone !!!
                  you all Rock!!!!!