Skip to content

Commit 72c991e

Browse files
author
Ryan Gordon
committed
Fixing width/height calculation so that each of the 4 viewports has a equal share of the viewer
1 parent 1455f20 commit 72c991e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/viewer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44

55
Viewer::Viewer() : shader_folder("src/shader/"),
6-
win_width(1280),
7-
win_height(800)
6+
win_width(600),
7+
win_height(400)
88
{
99
// init glfw - if already initialized nothing happens
1010
int init = glfwInit();
@@ -35,7 +35,7 @@ void Viewer::initialize()
3535
#endif
3636
//glfwWindowHint(GLFW_VISIBLE, debug ? GL_TRUE : GL_FALSE);
3737

38-
window = glfwCreateWindow(win_width, win_height, "Viewer (press ESC to exit)", 0, NULL);
38+
window = glfwCreateWindow(win_width*2, win_height*2, "Viewer (press ESC to exit)", 0, NULL);
3939
if (window == NULL)
4040
{
4141
std::cerr << "Failed to create opengl window." << std::endl;
@@ -122,7 +122,8 @@ void Viewer::winsize_callbackstatic(GLFWwindow* window, int w, int h)
122122

123123
void Viewer::winsize_callback(GLFWwindow* window, int w, int h)
124124
{
125-
win_width = w; win_height = h;
125+
win_width = w/2;
126+
win_height = h/2;
126127
}
127128

128129
void Viewer::key_callbackstatic(GLFWwindow* window, int key, int scancode, int action, int mods)

0 commit comments

Comments
 (0)