]> git.tdb.fi Git - gldbg.git/blob - flavors/gl/source/bufferstate.h
Decode and display element buffer contents
[gldbg.git] / flavors / gl / source / bufferstate.h
1 /* $Id$
2
3 This file is part of gldbg
4 Copyright © 2009-2010  Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
6 */
7
8 #ifndef BUFFERSTATE_H_
9 #define BUFFERSTATE_H_
10
11 #include <string>
12 #include <vector>
13 #include "opengl.h"
14
15 struct ArrayState;
16
17 struct BufferContent
18 {
19         struct Array
20         {
21                 GLenum kind;
22                 unsigned index;
23                 unsigned size;
24                 GLenum type;
25                 int offset;
26
27                 Array();
28                 Array(const ArrayState &);
29         };
30
31         bool consistent;
32         unsigned stride;
33         std::vector<Array> arrays;
34
35         BufferContent();
36         void update(const ArrayState &);
37         void update_elements(GLenum);
38         std::string describe() const;
39 };
40
41 struct BufferState
42 {
43         unsigned id;
44         GLenum target;
45         GLenum usage;
46         unsigned size;
47         char *data;
48         BufferContent content;
49
50         BufferState();
51         void set_data(unsigned, const void *, GLenum);
52         void set_sub_data(unsigned, unsigned, const void *);
53         std::string describe() const;
54 };
55
56 #endif