OpenStructure
build-2.9.0-doc
stage
include
ost
gfx
texture.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// This file is part of the OpenStructure project <www.openstructure.org>
3
//
4
// Copyright (C) 2008-2020 by the OpenStructure authors
5
//
6
// This library is free software; you can redistribute it and/or modify it under
7
// the terms of the GNU Lesser General Public License as published by the Free
8
// Software Foundation; either version 3.0 of the License, or (at your option)
9
// any later version.
10
// This library is distributed in the hope that it will be useful, but WITHOUT
11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with this library; if not, write to the Free Software Foundation, Inc.,
17
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
//------------------------------------------------------------------------------
19
#ifndef OST_GFX_TEXTURE_HH
20
#define OST_GFX_TEXTURE_HH
21
22
/*
23
texture
24
25
Author: Ansgar Philippsen
26
*/
27
28
#include <boost/shared_array.hpp>
29
30
#include "
module_config.hh
"
31
#include "
glext_include.hh
"
32
33
namespace
ost
{
namespace
gfx {
34
35
struct
Bitmap;
36
37
class
Texture
38
{
39
public
:
40
Texture
():
41
w_(0),
42
h_(0),
43
d_()
44
{}
45
46
Texture
(GLint w, GLint h):
47
w_(w),
48
h_(h),
49
d_(new float[4*w*h])
50
{}
51
52
Texture
(
const
Bitmap
& b);
53
54
bool
IsValid
()
const
{
return
static_cast<
bool
>
(d_);}
55
56
float
*
data
() {
return
&d_[0];}
57
58
GLint
width
()
const
{
return
w_;}
59
GLint
height
()
const
{
return
h_;}
60
GLint
format
()
const
{
return
GL_RGBA;}
61
GLint
type
()
const
{
return
GL_FLOAT;}
62
GLint
border
()
const
{
return
0;}
63
64
private
:
65
GLint w_,h_;
66
boost::shared_array<float> d_;
67
};
68
69
}}
// ns
70
71
#endif
ost::gfx::Texture
Definition:
texture.hh:38
ost::gfx::Texture::Texture
Texture(const Bitmap &b)
ost::gfx::Texture::data
float * data()
Definition:
texture.hh:56
ost::gfx::Texture::height
GLint height() const
Definition:
texture.hh:59
ost::gfx::Texture::Texture
Texture()
Definition:
texture.hh:40
ost::gfx::Texture::width
GLint width() const
Definition:
texture.hh:58
ost::gfx::Texture::format
GLint format() const
Definition:
texture.hh:60
ost::gfx::Texture::border
GLint border() const
Definition:
texture.hh:62
ost::gfx::Texture::IsValid
bool IsValid() const
Definition:
texture.hh:54
ost::gfx::Texture::type
GLint type() const
Definition:
texture.hh:61
ost::gfx::Texture::Texture
Texture(GLint w, GLint h)
Definition:
texture.hh:46
glext_include.hh
ost
Definition:
base.dox:1
module_config.hh
ost::gfx::Bitmap
Definition:
bitmap_io.hh:37
Generated by
1.9.1