MCPcopy Create free account
hub / github.com/WayfireWM/wayfire / render

Method render

plugins/cube/cube.cpp:613–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611 }
612
613 void render(const wf::scene::render_instruction_t& data, std::vector<wf::auxilliary_buffer_t>& buffers)
614 {
615 data.pass->custom_gles_subpass([&]
616 {
617 if (program.get_program_id(wf::TEXTURE_TYPE_RGBA) == 0)
618 {
619 load_program();
620 }
621
622 GL_CALL(glClear(GL_DEPTH_BUFFER_BIT));
623 background->render_frame(data.target, animation);
624
625 auto vp = calculate_vp_matrix(data.target);
626
627 program.use(wf::TEXTURE_TYPE_RGBA);
628 GL_CALL(glEnable(GL_DEPTH_TEST));
629 GL_CALL(glDepthFunc(GL_LESS));
630
631 static GLfloat vertexData[] = {
632 -0.5, 0.5,
633 0.5, 0.5,
634 0.5, -0.5,
635 -0.5, -0.5
636 };
637
638 static GLfloat coordData[] = {
639 0.0f, 1.0f,
640 1.0f, 1.0f,
641 1.0f, 0.0f,
642 0.0f, 0.0f
643 };
644
645 program.attrib_pointer("position", 2, 0, vertexData);
646 program.attrib_pointer("uvPosition", 2, 0, coordData);
647 program.uniformMatrix4f("VP", vp);
648 if (tessellation_support)
649 {
650 program.uniform1i("deform", use_deform);
651 program.uniform1i("light", use_light);
652 program.uniform1f("ease",
653 animation.cube_animation.ease_deformation);
654 }
655
656 /* We render the cube in two stages, based on winding.
657 * By using two stages, we ensure that we first render the cube sides
658 * that are on the back, and then we render those at the front, so we
659 * don't have to use depth testing and we also can support alpha cube. */
660 GL_CALL(glEnable(GL_CULL_FACE));
661 render_cube(GL_CCW, buffers);
662 render_cube(GL_CW, buffers);
663 GL_CALL(glDisable(GL_CULL_FACE));
664
665 GL_CALL(glDisable(GL_DEPTH_TEST));
666 program.deactivate();
667 });
668 }
669
670 wf::effect_hook_t pre_hook = [=] ()

Callers 1

renderMethod · 0.45

Calls 9

custom_gles_subpassMethod · 0.80
get_program_idMethod · 0.80
useMethod · 0.80
attrib_pointerMethod · 0.80
uniformMatrix4fMethod · 0.80
uniform1iMethod · 0.80
uniform1fMethod · 0.80
render_frameMethod · 0.45
deactivateMethod · 0.45

Tested by

no test coverage detected