-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIcone.cpp
More file actions
58 lines (48 loc) · 1.64 KB
/
Icone.cpp
File metadata and controls
58 lines (48 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "Icone.h"
void Icone::Init(){
textureID = SOIL_load_OGL_texture(
this->filepath.c_str(),
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_POWER_OF_TWO
| SOIL_FLAG_MIPMAPS
//| SOIL_FLAG_MULTIPLY_ALPHA
//| SOIL_FLAG_COMPRESS_TO_DXT
//| SOIL_FLAG_DDS_LOAD_DIRECT
//| SOIL_FLAG_NTSC_SAFE_RGB
//| SOIL_FLAG_CoCg_Y
//| SOIL_FLAG_TEXTURE_RECTANGLE
);
visible=true;
pose={0,0,1};
}
void Icone::Tick(const int64_t &milliseconds){
}
void Icone::Render(){
if (visible){
glBindTexture( GL_TEXTURE_2D, textureID );
glEnable(GL_TEXTURE_2D);
glPushMatrix();
glTranslated(pose.x,pose.y,0);
glScalef(pose.scale,pose.scale,pose.scale);
glColor4f( 1.0f, 1.0f, 1.0f, 0.5f );
const float ref_mag = 0.1f;
float tex_u_max = 1.0f;//0.2f;
float tex_v_max = 1.0f;//0.2f;
glBegin(GL_QUADS);
glNormal3f( -ref_mag, -ref_mag, 1.0f );
glTexCoord2f( 0.0f, tex_v_max );
glVertex3f( -1.0f, -1.0f, -0.1f );
glNormal3f( ref_mag, -ref_mag, 1.0f );
glTexCoord2f( tex_u_max, tex_v_max );
glVertex3f( 1.0f, -1.0f, -0.1f );
glNormal3f( ref_mag, ref_mag, 1.0f );
glTexCoord2f( tex_u_max, 0.0f );
glVertex3f( 1.0f, 1.0f, -0.1f );
glNormal3f( -ref_mag, ref_mag, 1.0f );
glTexCoord2f( 0.0f, 0.0f );
glVertex3f( -1.0f, 1.0f, -0.1f );
glEnd();
glPopMatrix();
}
}