VR-Vantage API Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Tutorials
File List
File Members
include
vrvGraphics
DtBufferObject.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2009 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
7
8
#pragma once
9
10
#include <
vrvGraphics/vrvGraphics.h
>
11
12
namespace
makVrv
13
{
14
17
class
DT_DLL_VRVGRAPHICS
DtBufferObject
18
{
19
public
:
20
21
enum
ArrayType
22
{
23
Vertex3
,
24
Vertex4
,
25
Color3
,
26
Color4
,
27
Normal
,
28
TextureCoordinate
29
};
30
31
enum
Usage
32
{
33
Static
,
//Data hardly changes
34
Dynamic
,
//Data frequently changes
35
Stream
//Data usually changes
36
};
37
39
DtBufferObject
(Usage usage );
40
42
~
DtBufferObject
();
43
44
//Change the size of the buffer.
45
void
resize(
unsigned
int
sizeBytes);
46
47
//Get the buffer's size
48
unsigned
int
size()
const
;
49
51
inline
unsigned
int
objectId
()
const
{
return
myVertexBufferObjectId; }
52
53
//Set the size and initialize the buffer with data.
54
void
setData(
const
float
* data,
unsigned
int
sizeBytes);
55
56
//Upload a subsection of data starting at the offset for count floats,
57
//Either resize or setData must be called before uploading data.
58
void
uploadData(
unsigned
int
offsetBytes,
unsigned
int
sizeBytes,
const
float
* data);
59
60
//Bind the buffer for use.
61
void
bind(ArrayType type,
unsigned
int
stride = 0,
unsigned
int
offset = 0,
62
unsigned
int
textureUnit = 0);
63
64
//Unbind the buffer for use.
65
void
unbind(ArrayType type,
unsigned
int
textureUnit = 0);
66
67
protected
:
68
unsigned
int
myVertexBufferObjectId
;
69
unsigned
int
myUsage
;
70
unsigned
int
mySize
;
71
72
};
73
74
}
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)