Unofficial OpenGL Software Development Kit
0.5.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
distro
glsdk_0_5_1
glmesh
include
glmesh
StreamBuffer.h
Go to the documentation of this file.
1
2
#ifndef GLSDK_MESH_STREAM_BUFFER_H
3
#define GLSDK_MESH_STREAM_BUFFER_H
4
10
#include <string>
11
#include <exception>
12
#include <boost/noncopyable.hpp>
13
14
15
namespace
glmesh
16
{
19
21
class
StreamBufferException
:
public
std::exception
22
{
23
public
:
24
virtual
~
StreamBufferException
()
throw
() {}
25
26
virtual
const
char
*what()
const
throw
() {
return
message.c_str();}
27
28
protected
:
29
std::string message;
30
};
31
33
class
StoreAlreadyMappedException
:
public
StreamBufferException
34
{
35
public
:
36
StoreAlreadyMappedException
()
37
{
38
message =
"The StreamBuffer is already mapped; this operation can only be performed if unmapped."
;
39
}
40
};
41
43
class
NotEnoughStorageForMapException
:
public
StreamBufferException
44
{
45
public
:
46
NotEnoughStorageForMapException
(
size_t
requestedSize,
size_t
bufferSize);
47
};
48
50
class
NotEnoughRemainingStorageForMapException
:
public
StreamBufferException
51
{
52
public
:
53
NotEnoughRemainingStorageForMapException
(
size_t
pos,
size_t
requestedSize,
size_t
bufferSize);
54
};
55
57
58
61
83
class
StreamBuffer
:
public
boost::noncopyable
84
{
85
public
:
91
StreamBuffer
(
size_t
bufferSize);
92
94
~StreamBuffer
();
95
99
GLuint
GetVao
() {
return
m_vao;}
100
106
GLuint
GetBuffer
() {
return
m_bufferObject;}
107
111
size_t
GetBufferPosition
()
const
{
return
m_currOffset;}
112
116
size_t
GetSpaceRemaining
()
const
;
117
121
size_t
GetTotalBufferSize
()
const
{
return
m_bufferSize;}
122
130
void
InvalidateBuffer
();
131
140
class
Map
:
public
boost::noncopyable
141
{
142
public
:
168
Map
(
StreamBuffer
&storage,
size_t
numBytes,
bool
invalidateIfNotAvailable =
true
);
169
176
~Map
();
177
193
bool
Release
();
194
198
void
*
GetPtr
() {
return
m_pCurrPtr;}
199
200
private
:
201
StreamBuffer
*m_pData;
202
void
*m_pCurrPtr;
203
size_t
m_bytesMapped;
204
};
205
206
private
:
207
GLuint m_bufferObject;
208
const
size_t
m_bufferSize;
209
210
size_t
m_currOffset;
211
bool
m_isMapped;
212
213
GLuint m_vao;
214
};
216
}
217
218
#endif //GLSDK_MESH_STREAM_BUFFER_H
Generated on Mon Jul 29 2013 05:34:59 for Unofficial OpenGL Software Development Kit by
1.8.3.1