Professional Web Applications Themes

Loading dynamic 3d textures from cast member images - Macromedia Director 3D

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 , ...

  1. #1

    Default 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.











    braddini Guest

  2. #2

    Default Re: Loading dynamic 3d textures from cast member images

    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?

    openspark Guest

  3. #3

    Default Re: Loading dynamic 3d textures from cast member images

    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?


    braddini Guest

  4. #4

    Default Re: Loading dynamic 3d textures from cast member images

    Hi,
    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.

    Daniel.


    danieloizo Guest

  5. #5

    Default Re: Loading dynamic 3d textures from cast member images

    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

    idata.filename = "http://mydevserver/images/imagename.gif"

    on getImage(iData)
    iPath="/"&iData.filepath
    gNetID = preloadnetthing(iPath)
    end getImage

    on checkImage(iData)
    r = false
    if gNetId <> void then
    if netdone(gNetId) then
    if netError(gNetId) = "OK" then
    gNetId = void

    createMember(#bitmap,"mesh",iData.filepath,iData.n ame,[#dither:iData.dither])
    r= true
    else
    if netError(gNetId) <> "OK" then
    alert("There was a netError" && getNetErrorCodes(netError(gNetId)))
    netID = VOID
    end if


    end if
    end if
    end if
    return r
    end checkImage

    braddini Guest

  6. #6

    Default Re: Loading dynamic 3d textures from cast member images

    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!!!!!

    on checkImage(iData)
    addhistory(string(getstreamstatus(gNetID)),true)
    r = false

    if getstreamstatus(gNetID).bytesSoFar = getstreamstatus(gNetID).bytesTotal
    then

    if gNetId <> void then
    if netdone(gNetId) then
    if netError(gNetId) = "OK" then
    gNetId = void

    createMember(#bitmap,"mesh",iData.filepath,iData.n ame,[#dither:iData.dither])
    r= true
    else
    if netError(gNetId) <> "OK" then
    alert("There was a netError" &&
    getNetErrorCodes(netError(gNetId)))
    netID = VOID
    end if
    end if
    else

    end if
    end if
    end if

    return r
    end checkImage

    braddini Guest

Similar Threads

  1. Replies: 1
    Last Post: November 7th, 02:18 AM
  2. blending cast member images together
    By Dario Volaric in forum Macromedia Director Basics
    Replies: 1
    Last Post: April 13th, 12:55 PM
  3. Replacing cast member images...
    By _Lars_ webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 2
    Last Post: November 6th, 02:48 AM
  4. Too many open files versus out of memory loading cast member
    By Dave|MediaSense webforumsuser@macromedia.com in forum Macromedia Director Lingo
    Replies: 1
    Last Post: September 2nd, 07:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139