gKit2 light

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Ringbuffer.h
1
2
3 class Ringbuffer
4 {
5 // non copyable
6 Ringbuffer( const Ringbuffer& );
7 Ringbuffer& operator= ( const Ringbuffer& );
8
9 public:
10 Ringbuffer( ) : size(0), static_size(0), dynamic_size(0), buffers(0), map(nullptr), name(0) {}
11
12 int create( const std::size_t _static, const std::size_t _dynamic, const int _buffers );
13 int release( );
14
15 void *map_static_buffer( );
16 int flush_static_buffer( );
17 std::size_t static_buffer_offset( );
18 GLuint static_buffer( );
19
20 void *map_buffer( const unsigned int id );
21 int flush_buffer( const unsigned int id );
22 std::size_t buffer_offset( const unsigned int id );
23 GLuint buffer( const unsigned int id );
24
25 std::size_t size;
26 std::size_t static_size;
27 std::size_t dynamic_size;
28 int buffers;
29
30 void *map;
31 GLuint name;
32 };
33
34 /*
35 solution 1 :
36 1 vao, reconfigure a chaque batch
37 glBindVertexArray(vao);
38 glBindVertexArrayPointer(static attribute 0, ring->offset_static_buffer + attribute 0 offset, attribute 0 stride)
39 glBindVertexArrayPointer(dynamic attribute 0, ring->offset_buffer(0) + attribute 0 offset, attribute 0 stride)
40
41 solution 2 :
42 1 vao reconfigure par VertexFormat
43 glBindVertexArray(vao)
44
45 glVertexAttribFormat(static attribute 0 )
46 glVertexAttribBinding(0)
47
48 glVertexAttribFormat(dynamic attribute 0 )
49 glVertexAttribBinding(1)
50
51 a chaque batch, update du buffer offset des attributs statiques / dynamiques
52 glBindVertexBuffer(0, ring->static_buffer(), ring->offset_static_buffer(), stride)
53 glBindVertexBuffer(1, ring->buffer(0), ring->offset_(0), stride)
54
55 solution 3 : creer un vao par buffer dynanique ?
56 */
Ringbuffer
Definition: Ringbuffer.h:3