example_recursive_cube(void)
	 : tex_side(512)
	 , rnd_tex(tex_side)
	 , cube(prog)
	 , current_buf(0)
	 , rad(0.0f)
	{
		gl.clear_color(0.8f, 0.8f, 0.8f, 0.0f);
		gl.clear_depth(1.0f);

		gl.enable(GL.depth_test);
		gl.enable(GL.cull_face);
		gl.cull_face(GL.back);
		gl.front_face(GL.ccw);
	}
Esempio n. 2
0
	void render(const example_state_view& state)
	override
	{
		gl.use(erase_prog);
		gl.disable(GL.depth_test);
		background.use();
		background.draw();

		shp_turns += 0.1f*state.frame_duration().value();

		gl.use(light_prog);
		gl.uniform(
			light_prog.modelview,
			matrix_rotation_x(turns_(shp_turns)/1)*
			matrix_rotation_y(turns_(shp_turns)/2)*
			matrix_rotation_z(turns_(shp_turns)/3)
		);

		gl.clear(GL.depth_buffer_bit);
		gl.enable(GL.depth_test);
		shape.use();
		shape.draw();
	}
Esempio n. 3
0
    cube_example(
        const example_state_view& state,
        eagine::memory::buffer& temp_buffer
    ): prog()
        , cube(
            temp_buffer,
            shapes::vertex_attrib_kind::position+
            shapes::vertex_attrib_kind::normal+
            shapes::vertex_attrib_kind::box_coord+
            shapes::vertex_attrib_kind::face_coord
        ), cam_orbit(0.5)
        , cam_turns(0.12f)
        , cam_pitch(0.72f)
        , cam_dist_dir(-1)
        , cam_turn_dir(1)
        , cam_elev_dir(1)
    {
        gl.clear_color(0.6f, 0.6f, 0.5f, 0);
        gl.clear_depth(1);
        gl.enable(GL.depth_test);

        set_projection(state);
    }