Hello @ross.grams. First of all Rendercam is great. Thank you, I love it.
I would like to use a shader with it. Nothing fancy. Lets say Grading (https://www.defold.com/tutorials/grading/)
Looks like it is possible. It “looks” (not sure if it works correct and efficient) fine until I resize the window. I don’t know much about the shaders but I guess setting view and projection cause a problem.
How can I handle the update correctly with Rendercam?
function update(self)
-- Set view and projection with latest matrices calculated by the module
render.set_view(rendercam.calculate_view())
render.set_projection(rendercam.calculate_proj())
-- Set viewport (x and y will be zero unless using a fixed aspect ratio)
render.set_viewport(vp.x, vp.y, vp.width, vp.height)
-- ** Render Target
render.enable_render_target(self.target)
render.set_depth_mask(true)
...
-- GUI Rendering
...
-- ** Disable Render Target
render.disable_render_target(self.target)
render.clear({[render.BUFFER_COLOR_BIT] = self.clear_color})
render.set_viewport(vp.x, vp.y, vp.width, vp.height)
render.set_view(vmath.matrix4())
render.set_projection(vmath.matrix4())
render.enable_texture(0, self.target, render.BUFFER_COLOR_BIT)
render.draw(self.grade_pred)
render.disable_texture(0, self.target)
end