-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMesh.h
More file actions
48 lines (38 loc) · 888 Bytes
/
Mesh.h
File metadata and controls
48 lines (38 loc) · 888 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
39
40
41
42
43
44
45
46
47
48
#pragma once
//
// メッシュ
//
// 補助プログラム
#include "gg.h"
using namespace gg;
class Mesh
{
// 頂点配列オブジェクト
GLuint vao;
public:
// コンストラクタ
Mesh()
{
// 頂点配列オブジェクトを作成する
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
}
// コピーコンストラクタを封じる
Mesh(const Mesh &mesh) = delete;
// 代入演算子を封じる
Mesh &operator=(const Mesh &mesh) = delete;
// デストラクタ
virtual ~Mesh()
{
// 頂点配列オブジェクトを削除する
glDeleteVertexArrays(1, &vao);
}
// 描画
virtual void draw(GLint slices, GLint stacks) const
{
// 頂点配列オブジェクトを指定する
glBindVertexArray(vao);
// 描画する
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, slices * 2, stacks - 1);
}
};