Skip to content

Commit a9160be

Browse files
committed
finish comments
1 parent 2cff767 commit a9160be

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

include/check_gl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct GLHandleBase {
5656
}
5757
};
5858

59-
template <class Derived>
59+
template <class Derived> // CRTP 模式
6060
struct GLHandleImpl : GLHandleBase {
6161
using GLHandleBase::GLHandleBase;
6262

src/Game.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
#include "fileutils.hpp"
66
#include "OBJ.hpp"
77

8-
struct Game::Private { // P-IMPL pattern
8+
struct Game::Private { // P-IMPL 模式
99
glm::mat4x4 viewMat;
1010
glm::mat4x4 projMat;
1111

1212
OBJ obj;
13-
DrawableOBJ drawable;
13+
DrawableOBJ drawableObj;
1414
GLProgram program;
1515
};
1616

@@ -53,7 +53,7 @@ void Game::initialize() {
5353
m_private->program = std::move(program);
5454

5555
m_private->obj.load_obj(OPENGLTUTOR_HOME "assets/monkey.obj");
56-
m_private->obj.draw_obj(m_private->drawable, /*dynamic=*/false);
56+
m_private->obj.draw_obj(m_private->drawableObj, /*dynamic=*/false);
5757
}
5858

5959
void Game::render() {
@@ -64,15 +64,6 @@ void Game::render() {
6464
CHECK_GL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
6565
CHECK_GL(glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT));
6666

67-
/* glBegin(GL_LINES); */
68-
/* glColor3f(1.0f, 1.0f, 1.0f); // 白色 */
69-
/* glVertex2f(-0.5f, 0.0f); // 左侧顶点 */
70-
/* glColor3f(0.0f, 0.0f, 0.0f); // 黑色 */
71-
/* glVertex2f(0.5f, 0.0f); // 右侧顶点 */
72-
/* CHECK_GL(glEnd()); */
73-
/* */
74-
/* return; */
75-
7667
auto projection = m_inputCtl.get_projection_matrix();
7768
auto view = m_inputCtl.get_view_matrix();
7869
glm::mat4x4 model(1.0f);
@@ -86,5 +77,5 @@ void Game::render() {
8677
glm::vec3 lightDir = glm::normalize(glm::vec3(mousePos.x, mousePos.y, 1));
8778
int location = glGetUniformLocation(m_private->program, "uniLightDir");
8879
CHECK_GL(glUniform3fv(location, 1, glm::value_ptr(lightDir)));
89-
m_private->drawable.draw();
80+
m_private->drawableObj.draw();
9081
}

0 commit comments

Comments
 (0)