-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexample.image.h
More file actions
38 lines (29 loc) · 735 Bytes
/
Copy pathexample.image.h
File metadata and controls
38 lines (29 loc) · 735 Bytes
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
#pragma once
#include "example.h"
#include <glwnd/tex2d.h>
class GLViewExampleImage : public GLView
{
public:
GLViewExampleImage() : GLView() {}
virtual ~GLViewExampleImage() {}
virtual void initial()
{
m_tex2d.initialize_from_image_file("assets\\example.png");
}
virtual void on_display()
{
glEnable(GL_TEXTURE_2D);
m_tex2d.use();
glBegin(GL_QUADS);
{
glTexCoord2i(0, 1); glVertex2f(-1.F, -1.F); // left bottom
glTexCoord2i(1, 1); glVertex2f(+1.F, -1.F); // right bottom
glTexCoord2i(1, 0); glVertex2f(+1.F, +1.F); // right top
glTexCoord2i(0, 0); glVertex2f(-1.F, +1.F); // left top
}
glEnd();
glDisable(GL_TEXTURE_2D);
}
private:
Tex2D m_tex2d;
};