Example #1
0
void
shader_blend(int m1, int m2) {
	if (m1 != BLEND_GL_ONE || m2 != BLEND_GL_ONE_MINUS_SRC_ALPHA) {
		rs_commit();
		RS->blendchange = 1;
		enum BLEND_FORMAT src = blend_mode(m1);
		enum BLEND_FORMAT dst = blend_mode(m2);
		render_setblend(RS->R, src, dst);
	}
}
Example #2
0
	manager::manager(shader_ptr shader)
	{
		// Reset errors, so we can track errors that happened here.
		glGetError();

		GLint blend_src_mode;
		GLint blend_dst_mode;
		// Save current blend mode
		glGetIntegerv(GL_BLEND_SRC, &blend_src_mode);
		glGetIntegerv(GL_BLEND_DST, &blend_dst_mode);
		blend_stack.push(blend_mode(blend_src_mode, blend_dst_mode, glIsEnabled(GL_BLEND) != 0));

		GLint atu;
		glGetIntegerv(GL_ACTIVE_TEXTURE, &atu);
		active_texture_unit.push(atu);

		if(shader == NULL || active_shader_program == shader) {
			return;
		}	

		if(active_shader_program != shader) {
			shader_stack.push(active_shader_program);
			active_shader_program = shader;
		}
		ASSERT_LOG(active_shader_program != NULL, "Active shader was NULL");
		active_shader_program->prepare_draw();

		GLenum err = glGetError();
		ASSERT_LOG(err == GL_NONE, "Error in shader code: " << shader->name() << " : 0x" << std::hex << err);
	}
Example #3
0
void gen_heightmap()
{
	use_shader(shader_generate);
	uniform("time", get_elapsed_time());
	blend_mode(false);
	depth_test(false);
	depth_write(false);
	glBindFramebuffer(GL_FRAMEBUFFER, rt_heightmap.fbo);
	glViewport(0, 0, rt_heightmap.width, rt_heightmap.height);
	clearc(0x00000000);
	mesh_quad.draw();
	glBindFramebuffer(GL_FRAMEBUFFER, 0);
	glViewport(0, 0, window_width, window_height);
}