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 <vector>
18 
19 namespace eagine::application {
20 class example;
21 //------------------------------------------------------------------------------
22 // programs
23 //------------------------------------------------------------------------------
24 class draw_program {
25 public:
26  void init(example&);
27  void set_projection(example&);
28 
29  void bind_position_location(example&, oglp::vertex_attrib_location);
30 
31  void use(example&);
32 
33 private:
35  oglp::uniform_location _camera_loc;
36 };
37 //------------------------------------------------------------------------------
38 class screen_program {
39 public:
40  void init(example&);
41 
42  void bind_position_location(example&, oglp::vertex_attrib_location);
43  void bind_tex_coord_location(example&, oglp::vertex_attrib_location);
44 
45  void set_screen_size(example&);
46 
47  void use(example&);
48 
49 private:
51  oglp::uniform_location _screen_size_loc;
52  oglp::uniform_location _draw_tex_loc;
53 };
54 //------------------------------------------------------------------------------
55 // geometry
56 //------------------------------------------------------------------------------
57 class shape_geometry {
58 public:
59  void init(example&);
60  void draw(example&);
61 
62  static auto position_loc() noexcept {
64  }
65 
66 private:
67  const int count = 8;
68 
70 
71  oglp::owned_buffer_name _positions;
72  oglp::owned_buffer_name _indices;
73 
74  oglp::owned_buffer_name _offsets;
75 
76  std::vector<oglp::shape_draw_operation> _ops{};
77 };
78 //------------------------------------------------------------------------------
79 class screen_geometry {
80 public:
81  void init(example&);
82  void draw(example&);
83 
84  static auto position_loc() noexcept {
86  }
87 
88  static auto tex_coord_loc() noexcept {
90  }
91 
92 private:
94 
95  oglp::owned_buffer_name _positions;
96  oglp::owned_buffer_name _tex_coords;
97 
98  std::vector<oglp::shape_draw_operation> _ops{};
99 };
100 //------------------------------------------------------------------------------
101 // draw buffers
102 //------------------------------------------------------------------------------
103 class draw_buffers {
104 public:
105  void init(example&);
106  void resize(example&);
107 
108  void draw_offscreen(example&);
109  void draw_onscreen(example&);
110 
111 private:
112  oglp::gl_types::sizei_type _width{0};
113  oglp::gl_types::sizei_type _height{0};
117 };
118 //------------------------------------------------------------------------------
119 } // namespace eagine::application
120 
121 #endif
Application harness / wrapper code is placed in this namespace.
Definition: eagine.hpp:72
GLsizei sizei_type
Signed integer size type.
Definition: config.hpp:88
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< renderbuffer_tag > owned_renderbuffer_name
Alias for owned GL renderbuffer object handle.
Definition: object_name.hpp:198
gl_owned_object_name< texture_tag > owned_texture_name
Alias for owned GL texture object handle.
Definition: object_name.hpp:213
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
gl_owned_object_name< framebuffer_tag > owned_framebuffer_name
Alias for owned GL framebuffer object handle.
Definition: object_name.hpp:178

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