Skip to content
This repository was archived by the owner on Oct 7, 2023. It is now read-only.

Commit 25cf26b

Browse files
committed
배경과 클라이언트 외부 배경의 렌더링 구현
1 parent d855150 commit 25cf26b

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

OpenGL/System.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,15 @@ bool gl::System::Begin(win32::GraphicDeviceContext& painter) noexcept
9191
return false;
9292
}
9393

94+
auto& view_x = ViewX();
95+
auto& view_y = ViewY();
96+
auto& view_w = ViewWidth();
97+
auto& view_h = ViewHeight();
98+
9499
nativeContext = std::addressof(painter);
95100

96101
myBlender->Apply();
97-
::glViewport(mySettings.viewPort.x, mySettings.viewPort.y, mySettings.viewPort.w, mySettings.viewPort.h);
102+
::glViewport(view_x, view_y, view_w, view_h);
98103
::glClear(GL_DEPTH_BUFFER_BIT);
99104

100105
::glMatrixMode(GL_PROJECTION);
@@ -104,17 +109,20 @@ bool gl::System::Begin(win32::GraphicDeviceContext& painter) noexcept
104109
global::SetBackgroundColour(mySettings.borderColour);
105110
::glClear(GL_COLOR_BUFFER_BIT);
106111

112+
::glPushMatrix();
107113
::glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
114+
::glLoadIdentity();
108115

116+
const auto& color = mySettings.backgroundColour;
117+
const float border = 1.01f;
109118

110-
::glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
111-
112-
113-
global::SetBackgroundColour(mySettings.backgroundColour);
114-
115-
::glMatrixMode(GL_MODELVIEW);
116-
::glPushMatrix();
117-
::glLoadIdentity();
119+
::glBegin(GL_TRIANGLE_FAN);
120+
::glColor3f(float(color.R) / 255.0f, float(color.G) / 255.0f, float(color.B) / 255.0f);
121+
::glVertex3f(-border, -border, 0);
122+
::glVertex3f(-border, border, 0);
123+
::glVertex3f(border, border, 0);
124+
::glVertex3f(border, -border, 0);
125+
::glEnd();
118126

119127
return true;
120128
}

0 commit comments

Comments
 (0)