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
Draw.h
Go to the documentation of this file.
1
2
#ifndef GLSDK_MESH_DRAW_H
3
#define GLSDK_MESH_DRAW_H
4
10
#include <vector>
11
#include <string>
12
#include <exception>
13
#include <glm/glm.hpp>
14
#include <glm/gtc/half_float.hpp>
15
#include "
VertexFormat.h
"
16
#include "
StreamBuffer.h
"
17
#include "
VertexWriter.h
"
18
19
namespace
glmesh
20
{
23
25
class
DrawException
:
public
std::exception
26
{
27
public
:
28
virtual
~
DrawException
()
throw
() {}
29
30
virtual
const
char
*what()
const
throw
() {
return
message.c_str();}
31
32
protected
:
33
std::string message;
34
};
35
37
class
TooFewVerticesSentException
:
public
DrawException
38
{
39
public
:
40
TooFewVerticesSentException
(
int
numProvided,
size_t
numStated);
41
};
42
44
class
TooManyVerticesSentException
:
public
DrawException
45
{
46
public
:
47
TooManyVerticesSentException
()
48
{
49
message =
"You provided more attribute data than you said you would."
;
50
}
51
};
52
54
class
PrimitiveTypeUnsupportedException
:
public
DrawException
55
{
56
public
:
57
PrimitiveTypeUnsupportedException
(
const
std::string &primTypename)
58
{
59
message =
"The primitive type \""
+ primTypename +
"\" is not supported by OpenGL."
;
60
}
61
};
62
64
class
VertexCountPrimMismatchException
:
public
DrawException
65
{
66
public
:
67
VertexCountPrimMismatchException
(
const
std::string &primName,
const
std::string &primReqs,
68
size_t
vertexCount);
69
};
70
72
75
105
class
Draw
:
public
VertexWriter
<Draw>
106
{
107
public
:
125
Draw
(GLenum primType,
size_t
vertexCount,
const
VertexFormat
&fmt,
StreamBuffer
&buffer);
126
136
~Draw
();
137
149
bool
Render
();
150
151
private
:
152
GLenum m_primType;
153
size_t
m_vertexCount;
154
const
VertexFormat
&m_fmt;
155
StreamBuffer::Map
m_map;
156
StreamBuffer
&m_buffer;
157
158
const
size_t
m_bufferOffset;
159
int
m_verticesRemaining;
160
std::vector<GLubyte> m_tempBuffer;
161
162
163
//No copying.
164
Draw
(
const
Draw
&);
165
Draw
& operator=(
const
Draw
&);
166
167
void
WriteAttribute(
const
void
*pData,
size_t
bytesPerComponent,
size_t
currAttrib );
168
void
*GetPtrForAttrib(
size_t
currAttrib);
169
void
*GetOutputPtrForVertex();
170
171
template
<
typename
BaseType>
172
void
VerifyType();
173
174
int
InternalRender();
175
176
friend
class
VertexWriter
<Draw>;
177
const
VertexFormat
&GetVertexFormat()
const
{
return
m_fmt;}
178
};
179
181
}
182
#endif //GLSDK_MESH_DRAW_H
Generated on Mon Jul 29 2013 05:34:59 for Unofficial OpenGL Software Development Kit by
1.8.3.1