Graphics

 View Only
  • 1.  quad set material

    Posted 11-29-2019 00:52

    there is my code, i can't understand why need to use "quad.setmaterial(0,mat)"?

    Dim quad as xpquadobject
    Scene.getobjectbyname("代碼圖檔", quad)
    f Text >= "A" and Text <="Z" then
    Text= Text & "氣象主播名"
    Engine.getMaterialByName(Text, mat)
    quad.setmaterial(0,mat)
    quad.visible = true
    else
    quad.visible = fasle
    end if



  • 2.  RE: quad set material

    Posted 11-29-2019 17:04

    I don't see how you can use a greater than when comparing a string. "A" will cause the scene to see a string and to my mind greater than is a math comparison.  "quad.setmaterial(0,mat) basically says "take the material and apply it to the quad on the lowest level, in other words the base shader. That's about as far as my brain can take it.


    #XPression


  • 3.  RE: quad set material

    Posted 12-02-2019 02:24

    Hi Malcom ,thanks for respond,i have confuison with "shader", what  that means ,why i need to apply it on the lowest level 


    #XPression


  • 4.  RE: quad set material

    Posted 12-02-2019 18:46

    Andy, 

    When you make a new material you can add specific files to it. This is done by adding a "new shader". The little blue ball in the material set up. Let's say you have a material with a .png file attached to it. The .png file will be in a new shader. Unless you are going to add anything to it, you are placing your .png file on the base layer of a shader that is applied to a layer (silver ball) on a new material.

     


    #XPression


  • 5.  RE: quad set material

    Posted 12-03-2019 01:28

    Malcolm,

    Appericate Malcom,I undertand but i have another question"quad.set material(0 , mat)"  when i sub "0" to "1",Ross debug show"index out of ranger" what that means? what that effect? Big Thx


    #XPression


  • 6.  RE: quad set material

    Posted 12-03-2019 16:05

    I think that when you tried to go to "1", you got the error warning because there is no layer 1, only layer 0. You tried to apply a material to a shader layer that did not exist. If you add a second shader to the layer, you should be able to go to "1".


    #XPression


  • 7.  RE: quad set material

    Posted 12-03-2019 17:07

    remember this is written by computer people. They begin their count with 0, then 1.


    #XPression