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 
18 namespace eagine::application {
19 //------------------------------------------------------------------------------
20 // program
21 //------------------------------------------------------------------------------
22 class sphere_program {
23 public:
24  void init(execution_context&, video_context&);
25  void clean_up(video_context&);
26  void set_projection(video_context&, orbiting_camera&);
27 
28  void bind_position_location(video_context&, oglp::vertex_attrib_location);
29  void bind_offsets_block(video_context&, oglp::gl_types::uint_type);
30 
31 private:
33  oglp::uniform_location camera_matrix_loc;
34  oglp::uniform_location camera_position_loc;
35  oglp::uniform_location viewport_dim_loc;
36  oglp::uniform_block_index offset_blk_idx{0U};
37 };
38 //------------------------------------------------------------------------------
39 // geometry
40 //------------------------------------------------------------------------------
41 class icosahedron_geometry {
42 public:
43  void init(execution_context&, video_context&);
44  void clean_up(video_context&);
45  void draw(video_context&);
46 
47  static auto position_loc() noexcept {
49  }
50 
51  static auto offsets_binding() noexcept {
52  return 0U;
53  }
54 
55 private:
56  const int count = 4;
57 
59 
60  oglp::owned_buffer_name positions;
61  oglp::owned_buffer_name indices;
62  oglp::owned_buffer_name offsets;
63 
64  std::vector<oglp::shape_draw_operation> ops;
65 };
66 //------------------------------------------------------------------------------
67 } // namespace eagine::application
68 
69 #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
GLuint uint_type
Unsigned integer type.
Definition: config.hpp:73
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
prog_var_location< EAGINE_ID_V(UniformBlk)> uniform_block_index
Alias for shader program uniform block location wrapper.
Definition: prog_var_loc.hpp:159
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).