MVE - Multi-View Environment
mve-devel
Loading...
Searching...
No Matches
libs
ogl
texture.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2015, Simon Fuhrmann
3
* TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4
* All rights reserved.
5
*
6
* This software may be modified and distributed under the terms
7
* of the BSD 3-Clause license. See the LICENSE.txt file for details.
8
*/
9
10
#ifndef OGL_TEXTURE_HEADER
11
#define OGL_TEXTURE_HEADER
12
13
#include <memory>
14
15
#include "
mve/image.h
"
16
#include "
ogl/defines.h
"
17
#include "
ogl/opengl.h
"
18
19
OGL_NAMESPACE_BEGIN
20
24
class
Texture
25
{
26
public
:
27
typedef
std::shared_ptr<Texture>
Ptr
;
28
typedef
std::shared_ptr<Texture const>
ConstPtr
;
29
30
public
:
32
Texture
(
void
);
34
Texture
(
mve::ByteImage::ConstPtr
image);
35
37
static
Ptr
create (
void
);
38
40
~Texture
(
void
);
41
43
void
bind (
void
);
44
46
void
upload (
mve::ByteImage::ConstPtr
image);
47
48
private
:
49
GLuint tex_id;
50
};
51
52
/* ---------------------------------------------------------------- */
53
54
inline
55
Texture::Texture (
void
)
56
{
57
glGenTextures(1, &this->tex_id);
58
}
59
60
inline
61
Texture::Texture (
mve::ByteImage::ConstPtr
image)
62
{
63
glGenTextures(1, &this->tex_id);
64
this->upload(image);
65
}
66
67
inline
Texture::Ptr
68
Texture::create (
void
)
69
{
70
return
Ptr
(
new
Texture
);
71
}
72
73
inline
74
Texture::~Texture (
void
)
75
{
76
glDeleteTextures(1, &this->tex_id);
77
}
78
79
inline
void
80
Texture::bind (
void
)
81
{
82
glBindTexture(GL_TEXTURE_2D, this->tex_id);
83
}
84
85
OGL_NAMESPACE_END
86
87
#endif
/* OGL_TEXTURE_HEADER */
mve::Image::ConstPtr
std::shared_ptr< Image< T > const > ConstPtr
Definition
image.h:43
ogl::Texture
OpenGL texture abstraction.
Definition
texture.h:25
ogl::Texture::Ptr
std::shared_ptr< Texture > Ptr
Definition
texture.h:27
ogl::Texture::ConstPtr
std::shared_ptr< Texture const > ConstPtr
Definition
texture.h:28
image.h
defines.h
OGL_NAMESPACE_END
#define OGL_NAMESPACE_END
Definition
defines.h:14
OGL_NAMESPACE_BEGIN
#define OGL_NAMESPACE_BEGIN
Definition
defines.h:13
opengl.h
Generated on Thu Dec 21 2023 01:49:58 for MVE - Multi-View Environment by
1.9.8