Compare commits
2 commits
e19ee6d867
...
e7336cbf82
Author | SHA1 | Date | |
---|---|---|---|
e7336cbf82 | |||
2b274fb8c8 |
3 changed files with 11 additions and 6 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.idea/
|
|
@ -2,7 +2,6 @@ package dev.euph.engine.opengl;
|
||||||
|
|
||||||
import dev.euph.engine.core.data.ImageLoader;
|
import dev.euph.engine.core.data.ImageLoader;
|
||||||
import dev.euph.engine.rendering.resources.Texture;
|
import dev.euph.engine.rendering.resources.Texture;
|
||||||
import dev.euph.engine.rendering.resources.loader.TextureLoader;
|
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
|
|
@ -19,19 +19,24 @@ public class GLWindow extends Window {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (glfwGetPlatform() != GLFW_PLATFORM_WAYLAND) {
|
if (glfwGetPlatform() != GLFW_PLATFORM_WAYLAND) {
|
||||||
GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
GLFWVidMode videoMode = glfwGetVideoMode(glfwGetPrimaryMonitor());
|
||||||
assert vidmode != null;
|
assert videoMode != null;
|
||||||
glfwSetWindowPos(
|
glfwSetWindowPos(
|
||||||
id,
|
id,
|
||||||
(vidmode.width() - width) / 2,
|
(videoMode.width() - width) / 2,
|
||||||
(vidmode.height() - height) / 2
|
(videoMode.height() - height) / 2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
addResizeCallback((int newWidth, int newHeight) -> {
|
addResizeCallback((int newWidth, int newHeight) -> {
|
||||||
GLWindow.this.width = newWidth;
|
GLWindow.this.width = newWidth;
|
||||||
GLWindow.this.height = newHeight;
|
GLWindow.this.height = newHeight;
|
||||||
glViewport(0, 0, newWidth, newHeight);
|
|
||||||
|
float[] x = new float[1];
|
||||||
|
float[] y = new float[1];
|
||||||
|
glfwGetWindowContentScale(getId(), x, y);
|
||||||
|
|
||||||
|
glViewport(0, 0, (int) (newWidth * x[0]), (int) (newHeight * y[0]));
|
||||||
});
|
});
|
||||||
|
|
||||||
GL.createCapabilities();
|
GL.createCapabilities();
|
||||||
|
|
Loading…
Reference in a new issue