query jit.gl.material for textures


    Jul 30 2014 | 1:21 pm
    Hi
    I wonder if it is possible to query jit.gl.material on its textures. I want to create a little tool that allows me to copy the jit.gl.material's properties to the internal material of a drawgroup inside a jit.gl.model. sending "getdiffuse_texture" to jit.gl.material gives me an error.
    the material editor is using lua to do something similar, but with the lack of lua documentation this code looks wizardly, besides it seems to copy the stored texture into a matrix in order to display it. but I would like to have the texture reference.
    the problem could be easily solved if it was possible to reference a complete jit.gl.material to a drawgroup, but I havent found any hint's for this, eventhough the "getmaterial_dict $1" gives me a dict that looks awfully similar to the content of jit.gl.material.

    • Jul 30 2014 | 4:52 pm
      you can send the message "export_material" to a jit.gl.material object, save the material file to disk, and then send the message "import_material" prepended with "sendmaterial" followed by the drawgroup index, to import that material to the gl.model drawgroup.
      let me know if that doesn't do what you need.
      referencing external gl.material objects from a gl.model drawgroup is not currently supported, but consider your feature request registered.
    • Jul 30 2014 | 5:31 pm
      Rob, thanks for this quick answer. I am looking for a solution that is more interactive (I wanna animate some of the material properties).
      So To be on the safe side:
      Is there a way to query the jit.gl.material for its textures? When I import a jittermaterial and some textures (diffuse map or bump map) are included, how can I access them? I assume on import they will be converted into textures, right? If I can query the material for its textures, than I can pass all the material properties and textures to the drawgroup properties and textures.
    • Aug 01 2014 | 4:30 pm
      the material file defines what textures are used. you can query that using dict tools or javascript upon import.
    • Aug 01 2014 | 10:14 pm
      probably I phrased my question wrong: Is there a way to query jit.gl.material for the texture references (i.e. jit_gl_texture xxxxx_diffuse_tex) it creates and uses after the import of a material file? It is possible to set it via "diffuse_texture " but its not possible to query it via "getdiffuse_texture".
    • Aug 04 2014 | 4:11 pm
      these are messages, so no, there is no way to query them after the fact. can you not just capture and store any texture input to the gl.material yourself?
    • Aug 04 2014 | 4:27 pm
      can you not just capture and store any texture input to the gl.material yourself?
      absolutely. If its not possible then I will do just that. and maybe I will write my own jitter material importer, that would solve that problem :-)
      thank you.
    • Oct 30 2015 | 2:11 pm
      Why it doesn't work when I import a .PNG file into jit.gl.material? Because I tried to export material and it turned out to be a PNG file.
      If PNG is not supported, that type of file can be imported?
      Thanks.
    • Oct 31 2015 | 2:39 am
      Png is supported. Post a patch.