I have this render script update:
render.set_stencil_mask(0xff)
render.clear({[render.BUFFER_COLOR_BIT] = self.clear_color, [render.BUFFER_DEPTH_BIT] = 1, [render.BUFFER_STENCIL_BIT] = 0})
render.set_viewport(vp.x, vp.y, vp.width, vp.height)
render.set_render_target(self.pp_game_world)
default_renderer()
render.set_depth_mask(true)
render.set_view(rendercam.calculate_view())
render.set_projection(rendercam.calculate_proj())
-- Sprite and particle rendering
render.set_depth_mask(false)
render.disable_state(render.STATE_DEPTH_TEST)
render.disable_state(render.STATE_STENCIL_TEST)
render.enable_state(render.STATE_BLEND)
render.set_blend_func(render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA)
render.disable_state(render.STATE_CULL_FACE)
render.draw(self.particle_pred)
render.set_projection(rendercam.calculate_proj())
-- Model rendering
render.set_blend_func(render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA)
render.disable_state(render.STATE_CULL_FACE)
render.enable_state(render.STATE_DEPTH_TEST)
render.set_depth_mask(true)
render.draw(self.model_pred)
-- Debug rendering - physics debug, draw_line
render.disable_state(render.STATE_DEPTH_TEST)
render.disable_state(render.STATE_CULL_FACE)
render.draw_debug3d()
-- GUI Rendering
render.set_viewport(0, 0, rendercam.window.x, rendercam.window.y)
render.set_view(IDENTITY_MATRIX)
render.set_projection(self.gui_proj) -- gui_proj only calculated on update_window
render.enable_state(render.STATE_STENCIL_TEST)
render.draw(self.gui_pred)
render.draw(self.text_pred) -- Includes debug text from "draw_text" messages.
render.disable_state(render.STATE_STENCIL_TEST)
-- changes to post process
render.set_render_target(render.RENDER_TARGET_DEFAULT)
render.set_projection(vmath.matrix4())
render.set_view(vmath.matrix4())
render.enable_texture(0, self.pp_game_world, render.BUFFER_COLOR_BIT)
render.draw(self.post_processing_pred)
render.disable_texture(0)
and the quad fragment shader that uses the frame buffer:
varying mediump vec2 var_texcoord0;
uniform lowp sampler2D tex0;
//---------------------------------------------------------------------------
void main()
{
gl_FragColor=texture2D(tex0, var_texcoord0);
}
But instead of a defold logo, this is what im getting:
If anyone knows what might be happening, please tell me