OGLplus  (0.59.0) a C++ wrapper for rendering APIs

resources.hpp
1 
9 #ifndef OGLPLUS_EXAMPLE_RESOURCES_HPP // NOLINT(llvm-header-guard)
10 #define OGLPLUS_EXAMPLE_RESOURCES_HPP
11 
12 #include <oglplus/gl.hpp>
13 #include <oglplus/gl_api.hpp>
14 
17 #include <array>
18 
19 namespace eagine::application {
20 //------------------------------------------------------------------------------
21 // program
22 //------------------------------------------------------------------------------
23 class cubes_program {
24 public:
25  void init(execution_context&, video_context&);
26  void clean_up(video_context&);
27  void set_projection(video_context&, orbiting_camera& camera);
28  void update(execution_context&, video_context&);
29 
30  void bind_position_location(video_context&, oglp::vertex_attrib_location);
31  void bind_pivot_location(video_context&, oglp::vertex_attrib_location);
32  void bind_coord_location(video_context&, oglp::vertex_attrib_location);
33 
34  void drawing_surface(video_context&);
35  void drawing_edges(video_context&);
36 
37 private:
39  oglp::uniform_location camera_loc;
40  oglp::uniform_location center_loc;
41  oglp::uniform_location time_loc;
42  oglp::uniform_location edges_loc;
43 };
44 //------------------------------------------------------------------------------
45 // geometry
46 //------------------------------------------------------------------------------
47 class cubes_geometry {
48 public:
49  void init(execution_context&, video_context&);
50  void clean_up(video_context&);
51  void draw_surface(video_context&);
52  void draw_edges(video_context&);
53 
54  static auto position_loc() noexcept {
56  }
57 
58  static auto pivot_loc() noexcept {
60  }
61 
62  static auto coord_loc() noexcept {
64  }
65 
66 private:
68 
69  oglp::owned_buffer_name positions;
70  oglp::owned_buffer_name pivots;
71  oglp::owned_buffer_name coords;
72  oglp::owned_buffer_name indices;
73 
74  std::vector<oglp::shape_draw_operation> ops{};
75  std::array<oglp::shape_draw_subset, 2> subs{};
76 };
77 //------------------------------------------------------------------------------
78 } // namespace eagine::application
79 
80 #endif
Application harness / wrapper code is placed in this namespace.
Definition: eagine.hpp:72
prog_var_location< EAGINE_ID_V(Uniform)> uniform_location
Alias for shader program uniform location wrapper.
Definition: prog_var_loc.hpp:115
gl_owned_object_name< vertex_array_tag > owned_vertex_array_name
Alias for owned GL vertex array object handle.
Definition: object_name.hpp:224
prog_var_location< EAGINE_ID_V(VertexAttr)> vertex_attrib_location
Alias for program vertex attribute location wrapper.
Definition: prog_var_loc.hpp:104
gl_owned_object_name< program_tag > owned_program_name
Alias for owned GL program object handle.
Definition: object_name.hpp:188

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).