Render.enable_material not work in html5

My render does draw anything if i use render.enable_material(“shadow”)
I try to change material fragment program to sprite.fp. It does not help. Vertex program correctly work for another material.

    render.enable_material("shadow")
    render.enable_texture(0, self.before_light_target, render.BUFFER_COLOR_BIT)
    render.enable_texture(1, self.light_map_target, render.BUFFER_COLOR_BIT)
    render.draw(self.screen_pred)
    render.disable_texture(0, self.before_light_target, render.BUFFER_COLOR_BIT)
    render.disable_texture(1, self.light_map_target, render.BUFFER_COLOR_BIT)
    render.disable_material("shadow")

material

desktop


html

Could you check what the webbrowser console is saying? (A quick Google on how to debug through webconsole using: Google Chrome, Mozilla Firefox, Apple Safari, and Microsoft Edge.)

I have heard about certain browsers having problems with non-power-of-two textures… Could you try setting a static size of your render target textures to something like 1024x1024 or similar?

2 Likes

No warnings or error in console. I think it is not PoT, because i can render my render target,to model. By I check PoT later, and write here

In render i add material with name shadow. If this materiaI is screen.material draw work in html. If i copy screen.material and use copied value render does not work. I push all code to github, because i do not understand why it happened. If someone help me, it will be awesome.In desktop build render work allways. https://github.com/d954mas/defold_html5_problem

Well, when testing it now, I get loads of these in the webbrowser console (Chrome):
“INVALID_OPERATION: uniform4fv: location is not from current program”

So apparently something is a bit off.

Also, I noticed that you are not using the “shadow.material” that you think you are (you have 2). So, in the screen/shadow.material, you probably want to add another texture (as your previous picture suggests), and the shadow.material doesn’t use shadow.fp. But even after fixing that, I get the same error in the console. Unfortunately, I don’t have more time to spend right now :confused: (off for christmas vacation)

You are right. Now there is a error in console. When i watch yesterday there is no error for shadow/shadow.material. I have 2 shadow.material because i try to find why rendering not work in browser,and try different shaders and constants.So to not broke my shadow i make a copy) Thx, and happy christmas :slight_smile:

1 Like