本文整理匯總了Java中org.lwjgl.glfw.GLFW.glfwGetFramebufferSize方法的典型用法代碼示例。如果您正苦於以下問題:Java GLFW.glfwGetFramebufferSize方法的具體用法?Java GLFW.glfwGetFramebufferSize怎麽用?Java GLFW.glfwGetFramebufferSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.lwjgl.glfw.GLFW
的用法示例。
在下文中一共展示了GLFW.glfwGetFramebufferSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateViewPort
import org.lwjgl.glfw.GLFW; //導入方法依賴的package包/類
private void updateViewPort(ViewPort viewport)
{
if (viewport == this.defaultViewPort)
{
//FIXME: This is a fix (hack?) for Mac's weird hack to scale windows for compatibility
try (MemoryStack stack = MemoryStack.stackPush())
{
IntBuffer pWidth = stack.mallocInt(1);
IntBuffer pHeight = stack.mallocInt(1);
GLFW.glfwGetFramebufferSize(this.window.handle(), pWidth, pHeight);
GL11.glViewport(0, 0, pWidth.get(0), pHeight.get(0));
}
}
else
{
GL11.glViewport(viewport.getX(), viewport.getY(),
viewport.getWidth(), viewport.getHeight());
}
}
示例2: generate
import org.lwjgl.glfw.GLFW; //導入方法依賴的package包/類
public static Window generate(WindowHandle handle) {
long windowID = GLFW.glfwCreateWindow(handle.width, handle.height, handle.title, NULL, NULL);
if (windowID == NULL)
throw new GLFWException("Failed to create GLFW Window '" + handle.title + "'");
Window window = new Window(windowID, handle.width, handle.height);
GLFW.glfwSetWindowPos(windowID, Variables.X, Variables.Y);
int[] h = new int[1];
int[] w = new int[1];
GLFW.glfwGetFramebufferSize(windowID, w, h);
window.framebufferHeight = h[0];
window.framebufferWidth = w[0];
GLFW.glfwGetWindowSize(windowID, w, h);
window.height = h[0];
window.width = w[0];
window.pixelRatio = (float) window.framebufferWidth / (float) window.width;
return window;
}