NorMIT-nav
22.09
An IGT application
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
z
Functions
a
b
c
d
e
f
g
i
l
m
o
p
q
r
s
t
u
v
w
Variables
Typedefs
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Typedefs
a
b
c
d
e
f
i
j
l
m
n
o
p
r
s
t
v
Enumerations
Enumerator
a
c
d
g
h
i
l
n
p
r
s
t
u
v
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Functions
a
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
v
Variables
c
f
i
l
m
o
p
q
r
s
t
v
Typedefs
c
d
f
h
m
o
p
q
s
u
v
Macros
_
a
b
c
d
e
f
g
i
m
n
o
p
r
s
t
u
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
texture.h
Go to the documentation of this file.
1
#ifndef TEXTURE_H
2
#define TEXTURE_H
3
4
#include <stdio.h>
5
#include <string.h>
6
#include <iostream>
7
8
//OpenGL
9
#include <GL/glew.h>
10
#include <glut.h>
//Framework on Mac
11
12
//------------------------------------------------------------------------------------
13
14
#define MAX_TEXTURE_SIZE 1000
15
static
unsigned
char
generated_texture[
MAX_TEXTURE_SIZE
];
16
//static float generated_texture[MAX_TEXTURE_SIZE];
17
18
template
<
typename
TYPE>
19
TYPE *
generateTexture
(
unsigned
int
x,
unsigned
int
y,
unsigned
int
z,
20
TYPE red, TYPE green, TYPE blue, TYPE alpha,
21
bool
debug=
false
)
22
{
23
int
numberOfColorComponents = 4;
24
unsigned
int
data_size = x*y*z*numberOfColorComponents;
25
26
if
(data_size >
MAX_TEXTURE_SIZE
)
27
std::cout <<
"-----------------------> Error: trying to create texture bigger than the max size"
<< std::endl;
28
29
for
(
int
i=0; i<data_size; )
30
{
31
generated_texture[i++] = (TYPE)red;
32
generated_texture[i++] = (TYPE)green;
33
generated_texture[i++] = (TYPE)blue;
34
generated_texture[i++] = (TYPE)alpha;
35
36
}
37
38
if
(debug)
39
{
40
std::cout.precision(3);
41
for
(
int
i=0; i<data_size; ++i)
42
{
43
std::cout <<
' '
<< (TYPE) generated_texture[i];
44
}
45
std::cout << std::endl;
46
}
47
48
return
generated_texture;
49
};
50
51
52
//------------------------------------------------------------------------------------
53
54
#endif // TEXTURE_H
generateTexture
TYPE * generateTexture(unsigned int x, unsigned int y, unsigned int z, TYPE red, TYPE green, TYPE blue, TYPE alpha, bool debug=false)
Definition:
texture.h:19
MAX_TEXTURE_SIZE
#define MAX_TEXTURE_SIZE
Definition:
texture.h:14
CX
source
apps
OpenGLTestApplication
texture.h
Generated on Tue Sep 13 2022 11:06:12 for NorMIT-nav by
1.8.17